// To swap two variables, the easiest and more common way is: int a = 1; /* a -> A */ int b = 2; /* b -> B */ int c; c = a; /* c -> A */ a = b; /* a -> B */ b = c; /* b -> A */ // To complicate this thing, we could write: int a = 1; /* a -> A */ int b = 2; /* a -> B */ a = a + b; /* a -> A+B */ /* b -> B */ b = a - b; /* a -> A+B */ /* b -> A+B - B -> A */ a = a - b; /* a -> A+B - A -> B */ /* b -> A */ // Leading to the following macro #define ds( a, b ) (a -= (b = (a += b) - b)) // 'ds' standing for deadly swap; *obviously* ;-)