标签:ret 三元 printf turn 临时 code 异或 return int
int main()
{
int a = 3;
int b = 5;
//int tmp = 0;//临时变量
printf("a=%d,b=%d\n", a, b);
//tmp = a;
//a = b;
//b = tmp;
//加减法(缺陷,溢出)
//a = a + b;
//b=a - b;
//a = a - b;
//异或的方法
a = a ^ b;
b = a ^ b;
a = a ^ b;
printf("a=%d,b=%d\n", a, b);
return 0;
}
标签:ret 三元 printf turn 临时 code 异或 return int
原文地址:https://blog.51cto.com/15057883/2568155