Exchange a,b without using other variables
there are two ways:
1:
a=a+b;
b=a-b;
a=a-b;
//in this case, if a or b is a very big number, a+b maybe will overflow.
2:
a=a^b;
b=a^b;
a=a^b;
1:
a=a+b;
b=a-b;
a=a-b;
//in this case, if a or b is a very big number, a+b maybe will overflow.
2:
a=a^b;
b=a^b;
a=a^b;