首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 # include <stdio.h> # include <string.h> Struct A { int a; char b[10]; double c;}; struct A f(struct A t); main() { struc
有以下程序 # include <stdio.h> # include <string.h> Struct A { int a; char b[10]; double c;}; struct A f(struct A t); main() { struc
admin
2020-07-28
33
问题
有以下程序
# include <stdio.h>
# include <string.h>
Struct A
{ int a; char b[10]; double c;};
struct A f(struct A t);
main()
{ struct A a={1001,"ZhangDa",1098.0};
a=f(a); printf("%d,%s,%6.1f\n",a.a,a.b,a.c);
}
struct A f(Struct A t)
{ t.a=1002; strcpy(t.b,"ChangRong");t.c=1202.0;return t;}
程序运行后的输出结果是
选项
A、1002,ZhangDa,1202.0
B、1002,ChangRong,1202.0
C、1001,ChangRong,1098.0
D、1001,ZhangDa,1098.0
答案
B
解析
在主函数中定义结构体A的变量a,并对其赋初值,再调用函数f(a),在函数f(a)中对结构体变量a的各个成员重新进行了赋值操作,并把其值返回在屏幕上输出。
转载请注明原文地址:https://jikaoti.com/ti/eqD0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
请编写函数fun,对长度为7个字符的字符串,除首、尾字符外,将其余5个字符按ASCH码降序排列。例如,原来的字符串为:CEAedca,排序后输出为:CedeEAa。注意:部分源程序在文件PROG1.C中。请勿改动主函数main
请编写一个函数fun,它的功能是:计算n门课程的平均分,计算结果作为函数值返回。例如:若有5门课程的成绩是:90.5,72,80,61.5,55。则函数的值为:71.80。注意:部分源程序存在文件PROG1.C中。请勿改动主函
请编写函数fun,函数的功能是:将大于形参m且紧靠m的k个素数存入XX所指的数组中。例如,若输入17,5,则应输出:19,23,29,31,37。注意:部分源程序在文件PROG1.C文件中。请勿改动主函数main和其他函数中的任何内容,
有以下程序voidfun(inta,intb,intc){a=b;b=c;c=a;}main(){inta=10,b=20,c=30;fun(a,b,c);printf("%d,%d,%d\n",
下列叙述中错误的是
结构化程序设计的基本原则不包括
在数据管理的三个发展阶段中,数据的共享性好且冗余度最小的是
生产每种产品需要多种零件,则实体产品和零件间的联系是
算法的空间复杂度是指
以下关于简单程序设计的步骤和顺序的说法中正确的是()。【10年9月】
随机试题
农民郭某在自己承包的土地上挖了一个养鱼池进行甲鱼养殖。某食品有限公司的废水排放渠距离养鱼池只有50米远。郭某听说食品有限公司排放的废水中有很多营养物质,于是萌发了引废水养甲鱼的想法。一天夜里,郭某偷偷扒开食品有限公司的排污渠将废水引入自己的养鱼池。第二天郭
患者,男,57岁。因胃癌行胃癌根治术后2周,出现右下肢肿胀、疼痛,B超示右股静脉血栓形成,为防止肺栓塞,护理上不当的是
不属于激光热成像的胶片结构是
新生儿用药受哪些因素影响( )。
下列属于《招标投标法》规定的招标方式是:
简述班级授课的优点。
2011年,Z省对8个主要市场的进口额增速最快的三个国家或地区的进口额之和为()。
在卡特尔智力结构学说中,属于晶体智力的是()
[*]
Thedestructionofournaturalresourcesandcontaminationofourfoodsupplycontinuetooccur,largelybecauseoftheextreme
最新回复
(
0
)