怎么编写C程序:交换数据。对于输入的两个变量a和b,交换他们的值并输出

如题所述

第1个回答  推荐于2017-11-23
你这个问题也太简单了吧,看来你是初学者:
#include<stdio.h>
void main()
{
int a,b,t;
scanf("%d%d",&a,&b);
t=a;a=b;b=t;
printf("\n%d %d\n",a,b);
}本回答被提问者和网友采纳
第2个回答  2010-10-19
void my_swap(int *a, int *b)
{
int c;
c = *a;
*a=*b;
*b=c;
return;
}
相似回答