#include<stdio.h>
void swap1(int x, int y) { //形参是实参的临时拷贝
int temp = x;
x = y;
y = temp;
printf("交换后的值为%d %d\n", x, y);
}
void swap2(int* x, int* y) { //地址
int temp = *x;
*x = *y;
*y = temp;
}
int main() {
int a = 0;
int b = 0;
printf("请输入想要交换的两个数值:");
scanf_s("%d%d", &a, &b);
swap1(a, b);
swap2(&a, &b);
printf("交换后的值为%d %d\n", a, b);
return 0;
}