交换两个变量的值,不使用第三个变量。即a=3,b
21 查阅
参考答案:
a = a + b;
\r\n
b = a - b;
a = a - b;
or
a = a^b;// 只能对int,char..
b = a^b;
a = a^b;
or
a ^= b ^= a;
参考答案:
a = a + b;
\r\n
b = a - b;
a = a - b;
or
a = a^b;// 只能对int,char..
b = a^b;
a = a^b;
or
a ^= b ^= a;