Swap two numbers using bitwise XOR operator ^
We can swap two numbers using the XOR operator. The result of the bitwise XOR operator is 1 if the corresponding bits of two operands are opposite. It is denoted by ^. To know more about working of XOR, refer to this tutorial: https://youtu.be/zkQuKuITyYo It can also be written as, As the order of evaluation of XOR…