sdnu1070
来源:互联网 发布:火车票候车室查询软件 编辑:程序博客网 时间:2024/06/06 16:03
1070.交换a和b
Time Limit: 1000 MS Memory Limit: 32768 KB
Total Submission(s): 373 Accepted Submission(s): 230
Total Submission(s): 373 Accepted Submission(s): 230
Description
我们爱函数,我们喜欢用函数来交换a和b。给你两个整形数字,请用函数交换他们
Input
3 4
Output
4
3
3
Sample Input
34
Sample Output
43
Hint
一定要用函数来实现
Source
Sharpbai
#include<stdio.h>
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
int main()
{
int a,b;
scanf("%d%d",&a,&b);
swap(&a,&b);
printf("%d\n",a);
printf("%d\n",b);
return 0;
}