#include <stdio.h> void swap_pointers(int **q1, int **q2) { // Your logic here int *hold; hold = *q1; *q1 = *q2; *q2 = hold; } int main() { int a, b; scanf("%d %d", &a, &b); int *p1 = &a; int *p2 = &b; swap_pointers(&p1, &p2); printf("%d %d", *p1, *p2); return 0; }
given two addresses to pointers so you can change the content , which is pointing to int
Test Cases
Test Results
Input
10 20
Expected Output
20 10