首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include<stdio.h> void fun(int a,int b) { int t; t=a;a=b;b=t; } main() { int c
有以下程序: #include<stdio.h> void fun(int a,int b) { int t; t=a;a=b;b=t; } main() { int c
admin
2018-07-19
16
问题
有以下程序:
#include<stdio.h>
void fun(int a,int b)
{
int t;
t=a;a=b;b=t;
}
main()
{
int c[10]={1,2,3,4,5,6,7,8,9,0},i;
for(i=0;i<10;i+=2)
fun(c
,c[i+1]);
for(i=0;i<10;i++)
printf("%d,",c
);
printf("\n");
}
程序运行的结果是( )。
选项
A、1,2,3,4,5,6,7,8,9,0,
B、2,1,4,3,6,5,8,7,0,9,
C、0,9,8,7,6,5,4,3,2,1,
D、0,1,2,3,4,5,6,7,8,9,
答案
A
解析
在C语言中,函数参数传递的作用是“传值”,形参和实参是两个没有关系的变量。函数fun交换了参数值,但只是交换了形参的值,结果并不会传递给实参。所以数组c没有发生变化,原样输出。
转载请注明原文地址:https://kaotiyun.com/show/Ktxp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序运行后的输出结果是() main() {inta,b; a=50;b=90; printf("%d\n",(a,b)) }
若有定义:inta[2][3];,以下选项中对a数组元素正确引用的是()。
若函数调用时,参数为基本数据类型的变量,下列叙述中正确的是()。
下列关系运算的叙述中,正确的是______。
表达式1/2*(int)3.7/(int)(2.4*(1.5+2.5))值的数据类型为______。
定义int*swap()指的是______。
以下只有在使用时才为该类型变量分配内存的存储类说明是______。
下列程序段的输出结果是【】。main(){charb[]="Hello,you";b[5]=0;printf("%s\n",B);}
已知“inta=2,b=2,c=3;”,则执行完语句“a*=18+(b++)-(++C;”后,a的值是_____________。
长度为n的顺序存储线性表中,当在任何位置上插入一个元素概率都相等时,插入一个元素所需移动元素的平均个数为【】。
随机试题
患者,男,37岁。反复左眼红及眼球后部疼痛1年。曾按“结膜炎”给予抗生素滴眼液滴眼,症状无明显缓解,眼球转动时和夜间明显,伴头痛、恶心及复视。眼部检查:右眼视力1.5,左眼视力0.8,矫正视力1.5;左眼睑充血肿胀,结膜充血水肿;眼前节正常。眼底(-)
A.“P”切迹B.颧突C.腭小凹D.颊侧翼缘区E.远中颊角区下颌舌骨嵴前方,口底上升时的最高点
老年患者,女,近3个月来右颈部淋巴结肿大,如蚕豆大小。其可能性最小的病变是
质量为m的两小球带等量同号电荷q,现用长为l的细线悬挂于空中O点,如图7-1所示,当小球平衡时,测得它们之间的水平距离为x,此时绳子的张力为()。
机器设备的修理复杂系数主要由()等因素决定。
根据资源税法律制度的规定,下列各项中,不属于资源税征税范围的是()。
根据以下资料,回答126~130题。关于2013年4月该市放广播影视情况,能够从资料中推出的是:
互相尊重和主权领土完整
AguaranteeisdefinedintheStatuteofFrauds1677as"awrittenpromisemadebyonepersontobecollaterallyanswerablefor
Forthepastseveralyears,theSundaynewspapersupplementParadehasfeaturedacolumncalled"AskMarilyn".Peopleareinvite
最新回复
(
0
)