#include <stdio.h> // Implementation 4: Compact style with minimal variable declarations void swap_pointers(int **p1, int **p2) { // One-liner swap using temporary variable int *temp = *p1; *p1 = *p2; *p2 = temp; } int main() { int a, b; scanf("%d %d", &a, &b); // Compact pointer initialization int *x = &a, *y = &b; // Perform the swap swap_pointers(&x, &y); // Output swapped values printf("%d %d", *x, *y); return 0; }
Test Cases
Test Results
Input
10 20
Expected Output
20 10