题解 | 编写函数实现两数交换(指针方式)
编写函数实现两数交换(指针方式)
https://www.nowcoder.com/practice/380c764bdef64ad696cdfa90bfe85156
#include <stdio.h>
// write your code here......
void swap(int*p1, int*p2)
{
int temp;
temp=*p1;
*p1=*p2;
*p2=temp;
}
int main() {
int m, n;
scanf("%d",&m);
scanf("%d",&n);
// write your code here......
swap(&m,&n);
printf("%d %d",m,n);
return 0;
}

