// swap contents of a and b. int a = 42; int b = 149; b ^= a; a ^= b; b ^= a; // now a = 149 and b = 42 // Normally that would be done with: int a = 42; int b = 149; int temp = a; a = b; b = temp;