求大佬看看怎么编写这个程序
编写一个函数change,实现交换两个数的值。要求(要写出该函数的完整形式及返回语句,并写出完整的主函数,在主函数从键盘中输入两个数,并调用该函数进行交换。注意参数方式为地址传递方式)
2019-01-07 21:36
2019-01-07 21:38
2019-01-08 09:22
2019-01-08 09:59
2019-01-08 12:03
程序代码:#include <stdio.h>
void swap(int *a,int *b)
{
int t=*a;
*a=*b;
*b=t;
}
int main()
{
int a=1;
int b=2;
swap(&a,&b);
printf("%d\t%d\n",a,b);
return 0;
}
2019-01-08 12:30