Here are the statements for reference.
int x = 20; int y = 41; int z = 60; int* p = &x; int* q = &y; int* r = &z; *r = *q; q = p; *q = *r;
After the first six lines, we have
Then, after
*r = *q;we have
After
q = p;the picture is as follows.
Finally, after
*q = *r;it looks like this.
So the value of x is 41.