The following code
#include <iostream>
using namespace std;
int change(int *x){
*x = 4;
return 0;
}
int main(){
int z = 10;
cout << change(&z) << " * " << z << endl;
return 0;
}
produces the following output:
0 * 10
but I expect:
0 * 4
and gdb shows that "z = 4" after calling "change" function.