XOR Magic in programming is well known. The Exclusive-OR boolean expression is widely used in digital circuits. Today we will discuss its benefits and uses in computer programming. Boolean expression of XOR is

XOR Magic in programming

From the truth table it is clear that if we do XOR of two equal value then the output would be 0 otherwise 1. Let us learn some interesting use of XOR.

  • XOR to swap two distinct values without using third variable.