//接受a,b的地址 void swap(int* pa,int* pb){ int tmp = 0; tmp = *pa; *pa = *pb; *pb = tmp; } int main(){ int a = 10; int b = 20; printf("a=%d,b=%dn",a,b); swap(&a,&b);//传a,b的地址 printf("a=%d,b=%d",a,b); return 0; }
欢迎分享,转载请注明来源:内存溢出
//接受a,b的地址 void swap(int* pa,int* pb){ int tmp = 0; tmp = *pa; *pa = *pb; *pb = tmp; } int main(){ int a = 10; int b = 20; printf("a=%d,b=%dn",a,b); swap(&a,&b);//传a,b的地址 printf("a=%d,b=%d",a,b); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)