A-A+

#include<stdio.h>void swap(int x int y){int t;

2022-08-06 10:40:24 问答库 阅读 178 次

问题详情

#include<stdio.h>
void swap(int x,int y)
{int t;
t=x;x=y;y=t;
printf("%d%d",x,y);
}
main()
{int a=3,b=4;
swap(a,b);
printf("%d%dn",a,b);
}

参考答案

正确答案:
4 3 3 4
[解析]
#include<stdio.h>
void swap(int x,int y)/*形参为整型变量,参数传递的方式为非地址传递方式*/
{int t;
t=x;x=y;y=h
printf("%d%d",x,y);
}
main()
{int a=3,b=4;
swap(a,b);/*调用swap()函数*/
printf("%d%d\n",a,b);/*对函数swap()的调用并没有政变变量a和b的值*/
}

考点: