XOR lets you swap two variables without using a temporary variable. Here's how:
After these three operations, and have swapped values. Why? After the first line, holds . In the second line, (using and ). In the third line, . It's a clever trick, though using a temporary is usually clearer and just as fast.