#include <stdio.h> void swap(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; } int main(void) { int x = 1, y = 2; swap(&x, &y); printf("%d %d\n", x, y); return 0; }
exchange two values through addresses