问题:交换两个整形的数值
#include<stdio.h>
void swap(int*pa , int*pb)
{
int tmp=*pa;
*pa=*pb;
*pb=tmp;
}
int main()
{
int a=45;
int b=86;
printf("a=%d b=%d\n",a,b);
swap(&a,&b);//取地址,这里不需要再返回,自定义函数swap,且void
printf("a=%d b=%d\n",a,b);
return 0;
}
标签:tmp,函数,int,pb,pa,swap,解决问题,指针 From: https://blog.51cto.com/u_15806064/5827483