第一种方式:
int main(){
int a = 3, b = 4;
int temp = a;
a = b;
b = a;
printf("a=%d,b=%d", a, b);
}
第二种方式:
int main(){
int a = 3, b = 4;
a = a+b;
b = a - b;
a = a - b;
printf("a=%d,b=%d", a, b);
}
第三种方式:
int main(){
int a = 3, b = 4;
a = a ^ b;
b = a ^ b;
a = a ^ b;
printf("a=%d,b=%d", a, b);
} |
|