void Swap(int* pa, int* pb) // void表示空返回值标签:tmp,10,20,--,数值,pb,int,地址,pa From: https://blog.51cto.com/u_15845723/5798115
{
int tmp = 0;
tmp = *pa;
*pa = *pb;
*pb = tmp; // 交换地址,传址调用->交换值
}
int main()
{
int a = 10;
int b = 20;
printf("a = %d b = %d\n", a, b); // a = 10 b = 20
Swap(&a, &b);
printf("a = %d b = %d\n", a, b); // a = 20 b = 10
return 0;
}