题解 | 编写函数实现两数交换(指针方式)
编写函数实现两数交换(指针方式)
https://www.nowcoder.com/practice/380c764bdef64ad696cdfa90bfe85156
#include <stdio.h>
// write your code here......
void swap(int *a,int *b)
{
int step =*a;
*a=*b;
*b=step;
}
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;
}


查看1道真题和解析