Implementation 'a' swaps the values of a and b inside swap() but p and q remain unchanged in main().

Implementation 'b' swaps the the memory location of a and b (to which they are pointing to) inside swap(), hence p and q also get swapped in main().

Implementation 'c' is almost similar to 'a'. Though temp is a pointer to an integer, still, it swaps the values of a and b (and not the memory locations to which a and b are pointing to) inside swap() but p and q remain unchanged in main().

PS: One may want to try compiling all the three implementations in C++ and conclude the answer.