void swap(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
printf("a=%d,b=%d\n",a,b);
}
int main() {
int a = 0;
int b = 0;
scanf("%d %d",&a,&b);
printf("a=%d,b=%d\n",a,b);
swap(a,b);
return 0;
}
void swap(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
printf("a=%d,b=%d\n",a,b);
}
int main() {
int a = 0;
int b = 0;
scanf("%d %d",&a,&b);
printf("a=%d,b=%d\n",a,b);
swap(a,b);
return 0;
}
void swap(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
printf("a=%d,b=%d\n",a,b);
}
int main() {
int a = 0;
int b = 0;
scanf("%d %d",&a,&b);
printf("a=%d,b=%d\n",a,b);
swap(a,b);
return 0;
}
int main()
{
int a = 3;
int b = 5;
printf("交换前:a=%d b=%d\n", a, b);
a = a ^ b;
b = a ^ b;//a^b^b=a
a = a ^ b;//a^b^a=b
printf("交换后:a=%d b=%d\n", a, b);
登录后提交答案