To add to what Rick said; by default all parameters passed to a function in C or C++ are passed by value: a copy of the value is made and that is passed to the function.
That makes sense if you think about it - what would happen if it wasn't, and the actual value was passed?
void foo (int x)
{
x = x + 10;
}
That works fine for this:
int y = 666;
foo(y);
But what happens if you do this?
foo(666);
666 is a constant - you can't add ten to it and expect anything sensible to happen!
So parameters are passed by value and changes to the parameter inside the method do not affect the outside world:
void foo(int *x)
{
x++;
}
...
int y = 666;
int p = &y;
foo(p);
foo is passed a copy of the address that p points to, not the address of p - so changes to x inside the method do not affect p at all. To do that, you need to pass a reference to p, or a pointer to p.