I am finding it difficult to visualize this piece of code. I cannot seem to find the ans to this.
I did get the ans for
printf("**r = %d\n",**r);printf("**s = %d\n",**s);
but other variables are not matching the ans. Please help.
int f(int ** r, int ** s) { int temp = ** r; int temp2 = **s; int * z = *r; *r = *s; *s = z; printf("**r = %d\n",**r); printf("**s = %d\n",**s); *z += 3; **s -= 8; **r -= 19; return temp + temp2;}int main(void) { int a = 80; int b = 12; int * p = &a; int * q = &b; int x = f(&p, &q); printf("x = %d\n", x); printf("*p = %d\n", *p); printf("*q = %d\n", *q); printf("a = %d\n", a); printf("b = %d\n", b); return EXIT_SUCCESS;}
Expected output:
**r = 12**s=80x=92*p=-7*q=75a=75b=-7