这个会顺序结构代码的一种例子,置换两个变量的值
输入 a=1 b=2 输出 a=2 b=1
#include "stdio.h"
void test2(void);
main()
{
test2();
return 0;
}
void test2(void)
{
int a,b,c;
printf("input a,b:");
scanf("%d%d",&a,&b);
c=a;
a=b;
b=c;
printf("The result is : a=%d,b=%d\n",a,b);
printf("this is test2.\n");
}

网友评论