Similar questions 3 more →
Pointers & Memory

Answer & solution
Official answer: 2016.0 : 2016.0
Our answer: 2016
mystery swaps only its local pointer parameters; it never writes through either pointer. All pointed-to integers remain unchanged and the conditional a<c is false. The printed a is 2016.
C passes the pointer values by value, producing local copies of the addresses. Changing which address ptra or ptrb contains does not modify a,b,c or d. To swap integers the function would need assignments through *ptra and *ptrb; to swap caller pointer variables it would need a different interface. After the first call a remains 2016, so 2016<4 is false. The final call likewise has no effect on a before printing.