首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include struct A {int a;char b[10];double c;}; struct A f(struct A t); main() {struc
有以下程序 #include #include struct A {int a;char b[10];double c;}; struct A f(struct A t); main() {struc
admin
2019-04-24
18
问题
有以下程序
#include
#include
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.1 f\n",a.a,a.b,a.c);
}
struct A f(struct A t)
{t.a=1002;
strcpy(t.b,"WangPeng");t.c=1220.0;return t;}
程序运行后的输出结果是( )。
选项
A、1001,ZhangDa,1098.0
B、1002,ZhangDa,1220.0
C、1001,WangPeng,1098.0
D、1002,WangPeng,1220.0
答案
D
解析
在主函数中定义结构体A的变量a,并对其赋初值,再调用函数f(a),在函数f(a)中对结构体变量a的各个成员重新进行了赋值操作,并把其值返回在屏幕上输出。
转载请注明原文地址:https://jikaoti.com/ti/bJf0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序:#include<stdio.h>main(){inta[]={1,2,3,4,5,6,7,8,9,10,11,12,},*p=a+5,*q=NULL;*q=*(p+5);printf("%d%d\n",*p,
下列程序的输出结果是()。intf1(intx,inty){returnx>y?x:y;}intf2(intx,inty){returnx>y?y:x;}main(){inta=4,b=3,c=5,d=
设计程序时,应采纳的原则之一是()。
有以下结构体说明和变量的定义,且指针p指向变量a,指针q指向变量b,则不能把结点b连接到结点a之后的语句是【】。structnode{chardata;structnode*next;}a,b
下述关于数据库系统的叙述中正确的是
请补充函数fun(),该函数的功能是将字符串tt中的大写字母都改为对应的小写字母,其他字符不变。例如,若输入“AreyoucomefromSichuan?”,则输入“areyoucomefromsichuan?”。注意:部分源程序给
给定程序中,函数fun的功能是:利用指针数组对形参ss所指字符串数组中的字符串按由长到短的顺序排序,并输出排序结果。ss所指字符串数组中共有N个字符串,且串长小于M。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注意:源程序存放
已知下面的程序段,正确的判断是()。#defineM2#defineN(m)((M+1)*m)……x=3*(M+N(5));
有三个关系R、S和T如下:其中关系T由关系R和S通过某种操作得到,该操作为()。【09年9月】
C语言程序中,运算对象必须是整型数的运算符是
随机试题
下列药组中,不宜合用的有()(2008年第144题)
小余自幼跟爷爷奶奶一起生活,备受宠爱,是个十分调皮和任性的孩子。上小学时,小余才回到父母身边,和父母比较生疏,学习表现不佳,时常被父亲呵斥;小余也因此变得非常焦虑,上课注意力不集中,有时作业也完成不了,老师也反映小余在学校不爱说话,课间活动时常常一个人躲在
爆炸就是发生的激烈的化学反应。()
如果函数f(x)的定义域为[1,2],则函数f(1一lnx)的定义域为()?
经济订货模型是建立在一系列严格假设基础之上的,这些假设包括()。
A公司是一家有限责任公司,共有15位股东,其中股东甲持有20%有表决权的股权;股东乙持有15%有表决权的股权;股东丙持有10%有表决权的股权。A公司由于经营不善,连年亏损,净资产已经降至人民币300万元,包括董事长在内的几位董事陆续提出辞职。股东
2014年8月31日,十二届全国人大常委会第十次会议表决通过了关于设立烈士纪念日的决定,以法律形式将9月30日设立为烈士纪念日,并规定每年纪念日当天国家举行纪念烈士活动。选择将9月30日设立为烈士纪念日最有可能是因为()。
根据图1、图2回答问题经初步核算,全年生产总值为2710.28亿元,按可比价格计算,比上年增长13.7%,这一增速为1985年以来最快增长水平。三次产业实现全面增长,其中,第一产业增加值为455.67亿
只要天上有太阳并且气温在零度以下,街上总有很多人穿皮夹克。只要天下着雨并且气温在零度以上,街上总有人穿雨衣。有时,天上有太阳但却同时下着雨。如果上述断定为真,那么以下哪项一定为真?
A、Moredetailedlabeling.B、Simplelabeling.C、Preciselabeling.D、Basiclabeling.A文章最后提到,如今食品标签必须向消费者提供更为详细的信息,答案为A。
最新回复
(
0
)