The new discovery 2007-10-29 14:39

If that:

Known: int a = 3, b = 6; if not by the third variable is how to achieve a, b swap?

Individual solution:

a = a+b;

b = a-b;

a = a-b;

Later we found there is a method (XOR operation), as follows:

a = a^b;

b = a^b;

a = a^b;

Guess you like

Origin www.cnblogs.com/lu-ping-yin/p/10988619.html