临时变量法:
int a = 5;
int b = 4;
int temp = 0;
temp = a;
a = b;
b = temp;
异或法:
int a = 5;
int b = 6;
a = a^b;
b = a^b;
a = a^b;
加减法:
int a = 5;
int b = 56;
a = a+b;
b = a-b;
a = a-b;
原文地址:http://blog.51cto.com/13907933/2154275
时间: 2024-10-13 15:56:46