首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有下列程序: #include <stdio.h> #include <string.h> typedef struct{ char name[9];char sex;float score[2]; }STU; STU f(STU a) { STU b={
有下列程序: #include <stdio.h> #include <string.h> typedef struct{ char name[9];char sex;float score[2]; }STU; STU f(STU a) { STU b={
admin
2018-10-16
25
问题
有下列程序:
#include <stdio.h>
#include <string.h>
typedef struct{ char name[9];char sex;float score[2]; }STU;
STU 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
;
return a;
}
main( )
{ STU c={"Qian",’f’,95.0,92.0},d;
d=f(c); printf("%s,%c,%2.0f,%2.0f\n",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/dwxp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若变量均已正确定义并赋值,以下合法的C语言赋值语句是
有以下程序: int f(int n) { if(n ==1)return 1; else return f(n-1)+1; } main( ) { int i,j=0; for(i=1;i
设变量x和Y均已正确定义并赋值,以下if语句中,在编译时将产生错误信息的是()。
运行以下程序后,如果从键盘上输入china#<回车>,贝愉出结果为_______。#include<stdio.h>main(){intv1=0,v2=O;charch;while((ch=getchar
下列关于标识符的说法中错误的是
阅读以下函数:fun(char*s1,char*s2){inti=0;while(s1[i]==s2[i]&&s2[i]!=’\0’)i++;return(s1[i]==’\0’&&s2[i]==
对于白箱(盒)测试用例的各设计准则,下列叙述中正确的是()。
已知二叉树后序遍历序列是dabec,中序遍历序列是debac,它的前序遍历序列是
随机试题
土地总面积包括陆地面积和()
下肢动脉血栓栓塞最常来源于()(2007年)
血小板以哪种为实体,通过纤维蛋白原相互连接而聚集
尹某因与马某共同盗窃而被公安机关依法逮捕。由于尹某家族生活困难,父母和妻子均无任何收入,全家的生活全靠他一个人支撑,故申请取保候审。公安机关经审查认为,尹某可以取保候审。那么,可以作为尹某的保证人的是( )。
渗漏试验常用于检查( )。
以下是三个《背影》的教学案例,请作简要评析。例一一、课内交流段落提纲:回家奔丧——丧事毕,赴南京,父子同行;事虽忙,不放心,亲自送行南京送别——看行李,拣座位,再三叮咛;穿铁道,见背影,几度落泪北京思父——持父信,见背影,泪光晶莹二、讨论:1
戏剧的真实,其基本品质之一是能使观众信以为真。观众明知戏是假的,舞台所演是个虚构的世界,看戏是娱乐,是一种精神游戏,为什么又很乐意在心理上接受戏剧的支配,做“介于信与不信之间的有意识的自欺”呢?原因就在舞台上表现的人生,能使观众产生可以出人于自身经历的种种
Whilemanyworkersarewillingtolearnnewskillsorcompletelyretraintoimprovetheirfutureemployability,fewfeeltheyar
投资投票不是稳妥的赚钱方式,因为你无法保证投资的公司一定业绩好。股票上涨,公司也可能业绩差;股票下跌,投资者损失。股票的涨跌背后的原因是复杂的。每个人都希望股票市场上涨,但是有时候,甚至业绩好的公司,其股票也有可能会下跌。股票市场一向如此。
THEHYDROGENECONOMYItseems-likeeverydaythereisanewannouncementinthenewsaboutautomobilespoweredbyfuelcells
最新回复
(
0
)