#include <stdio.h>
int main() {
void swap(int *, int *);
int a,b;
a=12;
b=15;
printf("%d,%d\n", a, b);
swap(&a, &b);
printf("%d,%d", a, b);
return 0;
}
//把a的值给b,b的值给a,把地址当
void swap(int *a,int *b){
int temp;
temp=*a;
*a=*b;
*b=temp;
}
把地址当参数传递
最新推荐文章于 2022-09-29 10:33:55 发布