调用函数交换两个值
完整代码
#include <stdio.h>
#include<windows.h>
#include<string.h>
void fun1(int* a, int* b){
int temp = 0;
temp = *a;
*a =* b;
*b = temp;
}
int main(){
int a = 10, b = 20;
fun1(&a,&b);
printf("交换后的数为:%d,%d\n", a,b);
system("pause");
return 0;
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/15e63653503367a35150e3776f6f7f1d.png)