首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include typedef struct { char name[9]; char sex; float score[2]; } STU; void f(STU a) { STU b={"Zhao", ’m’, 8
有以下程序 #include #include typedef struct { char name[9]; char sex; float score[2]; } STU; void f(STU a) { STU b={"Zhao", ’m’, 8
admin
2015-07-28
22
问题
有以下程序
#include
#include
typedef struct { char name[9]; char sex; float score[2]; } STU;
void f(STU a)
{
STU b={"Zhao", ’m’, 85.0, 90.0};
int i;
strcpy(a.name, b.name);
a.sex = b.sex;
for (i=0; i<2; i++)
a.score
= b.score
;
}
main()
{
STU c={"Qian", ’f’, 95.0, 92.0};
f(c);
printf("%s,%c,%2.0f,%2.0f\n", c.name, c.sex, c.score[0], c.score[1]);
}
程序的运行结果是( )。
选项
A、Qian,f,95,92
B、Qian,m,85,90
C、Zhao,f,95,92
D、Zhao,m,85,90
答案
A
解析
函数f()传递的参数为结构体变量,也是一种值传参,形参的变化不能影响到实参,所以调用函数f(c)对c中的数据没有影响。所以输出结果为选项A)。
转载请注明原文地址:https://kaotiyun.com/show/I7Jp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下面程序的运行结果是______。 main() { char ch[7]={"65ab21"}; int i,s=0; for(i=0;ch[i]>="0’&&ch[i]<=’9’;i+=2) s=10*s+ch[i]-’0’; printf("%d\n
下列变量定义中合法的是______。
程序流程图中的菱形框表示的是【】。
C语言用于结构化程序设计的3种基本结构是______、选择结构和循环结构。
在下列语句中,其含义为“q为一个指针的函数,该指针指向整型数据”的定义语句是()。
若有说明inta[][3]={0,0);,则不正确的叙述是()。
下面关于完全二叉树的叙述中,错误的是______。
在C语言中(以16位PC机为例),一个float型数据在内存中所占的字节数为4:一个double型数据在内存中所占的字节数为【】。
以下选项中,非法的字符常量是______。
C语言规定,在一个源程序中,main函数的位置
随机试题
某工程项目发包人与承包人签订了施工合同,工期4个月,工程内容包括A、B两项分项工程,综合单价分别为360.00元/m3、220.00元/m3;管理费和利润为人材机费用之和的16%;规费和税金为人材机费用、管理费和利润之和的10%,各分项工程每月计划和实际
在MS—DOS方式下,可以键入_______命令退出。
A.whendidyougetbackB.WhatasurpriseIgotC.HowIadmireyouD.IamTomE.gotholdofF.gotthroughtoG
患者,男,18岁。因高热、胸痛、咳铁锈色痰入院。检查:急性热病病容,体温40℃,脉搏102次/分,X线胸片示左上肺大片片状阴影,白细胞19×109/L。治疗应首选
项目的评价指标可分为三类,不属于这三类的是()。
远成公司主要从事建筑工程,2012年开展了以下业务:(1)承包本市某建筑工程项目,并与建设方签订建筑工程施工总包合同,总包合同叫确工程总造价3000万元,其中200万元的建筑工程项目分包给甲建筑工程公司。年底工程项目全部完工,远成公司取得工程款3
上市公司行业类属的变更原因可能有( )。
学校教育不仅明显区别于其他社会活动,并能够依据社会的要求和儿童的身心发展规律科学地、切实有效地培育人才,并明显区别于家庭教育和社会生活教育。()
某公园在开门前有400人排队等待,开门后每分钟来的人数是固定的。一个人口每分钟可以进入10个游客。如果开放4个人口,开门20分钟后就没有人排队,现在开放6个入口,则开门多少分钟后就没有人排队?
用行扫描法查找按动的键时,若在一次扫描结束后,出现两个以上的_______出现在行列代码中,说明______产生。
最新回复
(
0
)