I am trying to get used to using pointers but i am struggling a bit whilde passing them into functions as parameters. I read that arrays are passed by reference to functions therefore a code like this can change the array elements(Assuming a valid array is given):
void f(int *b)
{
b[2]=1;
}
in main:
f(validArray);
However even though we pass the pointer this doesn't seem to work;
void foo(int *b)
{
b=b+2;
}
in main:
f(validArray);
doesn't move the pointer a step further. Why is that?