35. Swap Two Pointers Using Double Pointers

You are given two pointers, each pointing to different integer variables.

Task:

  • Write a function that swaps the pointers themselves (not the values).
  • After swapping, each pointer should now point to the other’s original variable.

 You must use double pointers (int **p1, int **p2) to swap addresses.
 

Example-1

Input: a = 10, b = 20
Output: a points to 20, b points to 10


Example-2

Input: a = 5, b = 15
Output: a points to 15, b points to 5


 

Loading...

Input

10 20

Expected Output

20 10