首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include StructA {int a;char b[10];double c;}; struct A f(structAt); main() {struct
有以下程序 #include #include StructA {int a;char b[10];double c;}; struct A f(structAt); main() {struct
admin
2018-01-11
51
问题
有以下程序
#include
#include
StructA
{int a;char b[10];double c;};
struct A f(structAt);
main()
{struct A a={1001,"ZhangDa",1098.0};
a=f(a);printf("%d,%s,%6.1 f\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,并对其赋初值,再调用函数坟a),在函数f(a)中对结构体变量a的各个成员重新进行了赋值操作,并把其值返回在屏幕上输出。
转载请注明原文地址:https://kaotiyun.com/show/6Gxp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若有下列定义(设int类型变量占2个字节):inti=8,j=9;则下列语句:printf("i=%%d,j=%%d\n",i,j);输出的结果是()。
有下列函数定义:intfun(doublea,doubleb){returna*b;)若下列选项中所用变量都已经正确定义并赋值,错误的函数调用是()。
语句int(*ptr)()的含义是()。
以下程序的输出结果是()。main(){inti=0,s=0:for(;;){if(i==3‖i==5)continue;if(i==6)break;1+
若有运算符:>、=、<<、%、sizeof,则它们按优先级(由高至低)的正确排列顺序为()。
有以下程序:#includemain(){charc1=’1’,c2=’2’:c1=getchar();c2=getchar();putehar(c1);putchar(c2);}当程序运行时输入a后,下列叙述中正确的是()。
长度为n的顺序存储线性表中,当在任何位置上插入一个元素概率都相等时,插入一个元素所需移动的元素的平均个数为________。
字符串“\\\”ABCDEF\“\\”的长度是()。
设一棵完全二叉树共有700个结点,则在该二叉树中有【】个叶子结点。
随机试题
意识是物质世界的主观映象,这说明()
下列哪项不是温热性药物所表示的作用
上颌骨骨折诊断中最有决定意义的症状是
中国金融期货交易所5年期国债期货最便宜可交割债券的票面利率为4%,则其转换因子()。
某市工商银行2008年第四季度发生如下经营业务:(1)受托发放为期1年、利率为8%的贷款200万元,每季按利息的10%收取手续费,贷款方已经支付当季利息;(2)吸收存款800万元,支付存款利息40万元,11月1日发放贷款1200万元,年利率10%
某工业企业按会计准则计提的坏账准备10万元,以下处理正确的是()。
某企业因生产急需流动资金,将一张面额为50万元,距到期日尚需126天的票据以7%的年贴现率卖给银行,企业能获得的贴现款为()元。
已知伪代码如右图所示,则输出结果S=______.
请将选中段落的文字设置为绿色底纹样式(标准色中的第6个)。
InwhichstatewasEmilyDicksonborn?
最新回复
(
0
)