#include #include void foo(int *a, int *b); void foo(int *a, int *b) { *a = 5; *b = 6; a = b; } int main(void) { int
Because when foo is called, the values of the pointers are copied into the function. If you want to change the values of the pointers themselves, you need to pass a pointer to a pointer into the function.
foo