标签:交换变量
三种方式
1. 定义第三方变量
2. 相加法
3. 异或法
int a = 3; int b = 5; int temp = a; a = b; b = temp; a = a+b; b = a-b; a = a-b; a = a^b; b = a^b; a = a^b;
交换2个变量的值
原文地址:http://8869176.blog.51cto.com/8859176/1866964