#include void swap1(int a, int b) { int temp = a; a = b; b = temp; } void swap2(int *a, int *b) { int *temp = a; a = b; b
Just for fun, exchange values without the use of a temporary variable
x = x ^ y y = x ^ y x = x ^ y