首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有下列程序: #include<stdio.h> #include<string.h> typedefstruct{charname[9];charsex;floatscore[2];}STU; STUf(STUa) {STUb={’’Zhao’’,’m’
有下列程序: #include<stdio.h> #include<string.h> typedefstruct{charname[9];charsex;floatscore[2];}STU; STUf(STUa) {STUb={’’Zhao’’,’m’
admin
2019-06-09
26
问题
有下列程序:
#include<stdio.h>
#include<string.h>
typedefstruct{charname[9];charsex;floatscore[2];}STU;
STUf(STUa)
{STUb={’’Zhao’’,’m’,85.0,90.0);inti;
strcpy(a.name,b.name);
a.sex=b.sex;
for(i=0;i<2;i++)a.score
=b.score
;
returna;
}
main( )
{STUc={“Qian’’,’f,95.0,92.0},d;
d=f(c);printf(”%s,%c,%2.0f,%2.0fW’,d.neme,d.sex,d.score[0],d.score[1]);
}
程序的运行结果是
选项
A、Qian,m,85,90
B、Zhao,f,95,92
C、Zhao,m,85,90
D、Qian,f,95,92
答案
D
解析
f( )函数的功能是对形参a的各个成员用结构体变量b的各个成员进行赋值后,然后返回变量a。在主函数中调用f(C函数时,将sTu类型的结构体变量c的值传递给形参a,函数f( )在对a的各个成员进行重新赋值后,再将返回变量a的值传给d,最后输出结构变量d的各个成员的值。
转载请注明原文地址:https://kaotiyun.com/show/PRRp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有下列程序:main(){inti,t[][3]={9,8,7,6,5,4,3,2,1};for(i=0;i<3;i++)printf(’’%d’’[2-i][i]);}程序执行后的输出结果是
若有以下程序{}j}include<stdio.h>yoidsp(int*a){intb=2;*a=*a*2:printf(’’%d,’’,*a);a=&b:*a=*a*2:printf(’’%d,’’,*a);)main(){
请编写函数fun,函数的功能是求出二维数组周边元素之和,作为函数值返回。二维数组中的值在主函数中赋予。例如:二维数组中的值为:1357929994699981
给定程序的功能是:从键盘输入若干行文本(每行不超过80个字符),写到文件myfile4.txt中,用.1作为字符串输入结束的标志。然后将文件的内容读出显示在屏幕上。文件的读写分别由自定义函数ReadText和WriteText实现。请在程序的下划
某二叉树的前序序列为ABCDEFG,中序序列为DCBAEFG,则该二叉树的深度(根结点在第1层)为()。
下面不属于软件开发阶段任务的是()。
以下选项中,值为1的表达式是()。
软件设计中模块划分应遵循的准则是()。
设有定义:inta=0,b=1,c=1;以下选项中,表达式值与其它三个不同的是()。
软件调试的目的是
随机试题
急性肾功能衰竭少尿是指24小时尿量小于【】
厥证的主要治疗原则是
患者,女性,30岁,尿频、尿急、尿痛伴腰痛,发热39℃,畏寒,外周血白细胞及分类正常。尿蛋白(+),尿沉渣白细胞10~15/HP,红细胞多数,白细胞管型1~3/HP。该病人下列处理最恰当的是
吴某被甲、乙合法追捕。吴某的枪中只有一发子弹,认识到开枪既可能打死甲也可能打死乙。设定吴某对甲、乙均有杀人故意,下列哪一分析是正确的?()(2016/2/5)
甲上市公司(以下简称“甲公司”)2×14年至2×16年发生的有关投资业务如下。(1)2×14年6月10日,甲公司与乙公司的原股东A公司签订股权收购协议,协议约定:甲公司以发行本公司普通股1000万股为对价取得乙公司60%的股权,协议约定的发行价格为4元/
受害人必须通过行政先行处理程序要求行政赔偿,才能在赔偿要求不能得到满足时提起诉讼。()
虚拟网络的基础是______技术。
A、B、C、D、A
【B1】【B20】
Whichofthefollowingwouldbethebesttitleforthepassage?Inwhatwayisthemarketveryrealforeachpersonorbusiness
最新回复
(
0
)