4 ms·
He meant if they are the same variable, not the same value. (E.g., you pass pointers to your function.) int swap(int * a, int * b) { (*a)^=(*b);
by jibiki 17y ago
He meant if they are the same variable, not the same value. (E.g., you pass pointers to your function.)
int swap(int * a, int * b)
{
(*a)^=(*b);
(*b)^=(*a);
(*a)^=(*b);
}
int x = 15;
int *y = &x;
int *z = &x;
swap(y,z); //Now *y == 0