首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 # include #include Struct A { int a;charb[10];double c;}; struct A f(struct A t); main() {structA a={1001,"ZhangDa",10
有以下程序 # include #include Struct A { int a;charb[10];double c;}; struct A f(struct A t); main() {structA a={1001,"ZhangDa",10
admin
2020-05-19
32
问题
有以下程序
# include
#include
Struct A
{ int a;charb[10];double c;};
struct A f(struct A t);
main()
{structA a={1001,"ZhangDa",1098.O};
a=f(a);printf("%d,%s,%6.1 f\n",a.a,a.b,a.c);
}
structA f(StructAt)
{ 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://kaotiyun.com/show/EyCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
给定程序MODI1.C中函数fun的功能是:将长整型数s中每一位上为偶数的数依次取出,构成一个新数放在t中。高位仍在高位,低位仍在低位。例如,当s中的数为:87653142时,t中的数为:8642。请改正程序中的错误,使它能得出正确的结
下列给定程序中,函数fun的功能是:先将字符串s中的字符按正序存放到字符串t中,然后把s中的字符按逆序连接到字符串t的后面。例如,当s中的字符串为“ABCDE”时,则t中的字符串应为“ABCDEEDCBA”。请改正程序中的错误,使它能得
下列给定程序中函数fun的功能是:把从主函数中输入的3个数,最大的数放在a中,中间的数放在b中,最小的数放在c中。例如,若输入的数为:551234,输出的结果应当是:a=55.0,b=34.0,c=12.0。请改正程序中的错误,使
下列给定程序中,函数fun的功能是:在形参s所指字符串中寻找与参数c相同的字符,并在其后插入一个与之相同的字符,若找不到相同的字符则不做任何处理。例如,若s所指字符串为“baacda”,c中的字符为a,执行后s所指字符串为“baaaacdaa”。
请编写函数fun,其功能是:将M行N列的二维数组中的数据,按列的顺序依次放到一维数组中。一维数组中数据的个数存放在形参n所指的存储单元中。例如,若二维数组中的数据为3333333344444444555
请编写函数fun,其功能是:计算并输出下列多项式的值。例如,当n=10时,函数值为0.909091。注意:部分源程序在文件PROG1.C中。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
给定程序中,函数fun的功能是:将形参std所指结构体数组中年龄最大者的数据作为函数值返回,并在main函数中输出。请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。注意:部分源程序给出如下。不得增行或删
请编写函数fun,函数的功能是查找X在s所指数组中下标的位置,并作为函数值返回,若X不存在,则返回一1。注意:部分源程序在文件PROC1.C文件中,请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
下列给定程序中,函数fun的功能是:从n个学生的成绩中统计出低于平均分的学生人数,此人数作为函数值返回,平均分存放在形参aver所指的存储单元中。例如,输入8名学生的成绩:80.5、60、72、90.5、98、51.5、88、64则低于
下面叙述中错误的是()。
随机试题
阳明温病,津液不足,大便秘结,或下后二、三日,下证复现,脉沉无力者,治宜选用
慢性肾小球肾炎的临床表现是
账账核对是对账工作的一项重要内容,下列各项中,不属于账账核对的是()。
应付账款账户的期初余额为贷方10万元,本期偿还借款2万元,该账户的期末余额为()。
下列关于商业银行短期借款和长期借款的说法不正确的是()。
下列关于短期融资券筹资的表述中,不正确的是()。
甲到乙的办公室送文件,乙不在。甲看见乙办公桌下的地上有一活期存折(该存折未设密码),便将存折捡走。乙回办公室后找不着存折,但看见桌上的文件,便找到甲问是否看见其存折,甲说没看到。甲下班后去银行将该存折中的5000元取走。甲的行为构成()。
根据下列文字资料回答题。2009年11月,首届世界低碳与生态经济大会暨技术博览会在江西南昌召开,在这次大会上,江西共签约项目143个,总投资为1046.95亿元,先后分三次签约:第一次,与23家央企签约37年合作项目,项目总投资为519.1亿元;第二次,
Migrationisusuallydefinedas"permanentorsemi-permanentchangeofresidence".However,ourconcerniswithmovementbetween
Nearlyacenturyago,biologistsfoundthatiftheyseparatedaninvertebrateanimalembryointotwopartsatanearlystageof
最新回复
(
0
)