I know that this code:
void incVar(int i){ i++; } We know this will create a copy of the integer and then increase that value, but not the actual value.
By nature: Methods in C create copies of parameters in their Stack Frame and not the original variable.
But:
void incVar(int *i){ (*i)++; } Is supposed to increase the actual value of the integer by the pointer dereference.
But then, why doesn't C just create a copy of the pointer *i instead? If this is the normal behavior with regular integers, then why doesn't the same thing happen with pointers?
iso that conclusion just comes out of nowhere.int *iwith the pointer de-reference operator*i. Stupidly, the C language uses the*symbol for many completely different things.