2808 explained code solutions for 75 technologies


cSwapping two variables values using the logical operator XOR


x ^= y ^= x ^= y;ctrl + c
x ^= y;

Perform the XOR operation between xand y. Store the value in x.

y ^=

Perform the XOR operation between the XOR-ed value of x and y. Store the value in y (it's now the original x).

x ^=

Perform the XOR operation between the XOR-ed value of y and x. Store the value in x (it's now the original y).