填空题
以下程序的运行结果是______。
int x;
main()
{ int a=5,b=8;
swap(a,b) ;
printf("a=%d,b=%d,x=%d/n",a,b,x);
}
swap(int a,int b)
{ int temp;
temp=a;a=b;
b=temp;x=a/b;
printf("x=%d/n",x);
}
【正确答案】
1、a=5,b=8,x=1。
【答案解析】[解析] 本题考查形参变量值的改变并不能传回给实参。因此主函数中最后输出的a和b仍为原来的初值5和8。