交换两个变量a和b方法
1.设置中间变量
c = a;
a = b;
b = c;
2.用异或
a = a ^ b;
b = a ^ b;
a = a ^ b;
3.加法操作
a = a + b;
b = a - b;
a = a - b;
交换两个变量a和b方法
1.设置中间变量
c = a;
a = b;
b = c;
2.用异或
a = a ^ b;
b = a ^ b;
a = a ^ b;
3.加法操作
a = a + b;
b = a - b;
a = a - b;