三种方式
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;
时间: 2024-12-28 11:36:55
三种方式
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;