首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 # 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
31
问题
有以下程序
# 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://kaotiyun.com/show/z13p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
给定程序中,函数fun的功能是:计算形参x所指数组中N个数的平均值(规定所有数均为正数),将所指数组中小于平均值的数据移至数组的前部,大于等于平均值的数据移至X所指数组的后部,平均值作为函数值返回,在主函数中输出平均值和移动后的数据。例如,有10个正
定义学生、教师和课程的关系模式S(S#,Sn,Sd,Dc,Sa)(其属性分别为学号、姓名、所在系、所在系的系主任、年龄);C(C#,Cn,P#)(其属性分别为课程号、课程名、先修课);SC(S#,C#,G)(其属性分别为学号、课程号和成绩)。包含对非主属性
下列关于数据库特点的说法中正确的是
下列叙述中正确的是
以下叙述中正确的是
软件设计中模块划分应遵循的准则是
在软件设计阶段不使用
一棵完全二叉树共有360个结点,则在该二叉树中度为1的结点个数为
有以下程序段structst{intx;int*y;}*pt;inta[]={1,2},b[]={3,4};structstc[2]={10,a,20,b};pt=c;以下选项中表达式的值为11的是
生产每种产品需要多种零件,则实体产品和零件间的联系是
随机试题
有下列()情形之一,以非法占有为目的,在签订、履行合同过程中,骗取对方当事人财物,数额较大的,构成合同诈骗罪。
男性,25岁。踢足球后淋雨,晚上突然寒战,高热,伴全身肌肉酸痛,右胸痛,深呼吸时加重,咳嗽,咳少量铁锈色痰。查体:急性病容,口角有疱疹,体温39.5℃,脉搏100次/分,右肺触觉语颤增强,叩诊呈浊音,可闻及支气管呼吸音。实验室检查:WBC21×109/L
易与FeCl3反应的是
患儿,10岁。两天前臀部及双下肢皮肤出现紫癜,伴腹痛阵作,口臭纳呆,腹胀便秘,今日出现便血,舌红,苔黄,脉滑数。其证型是()
人体内最重要的调节机制是
亲权[武大2014年研]
以下有关模板安装工程安全技术措施正确的是()。
下列不属于主动管理方法内容的有( )。
根据联合国《儿童权利公约》,政府各部门和机构在制定相关政策和落实措施时应首先考虑()。
Today,mostcountriesintheworldhavecanals.Somecanals,suchastheSuezorthePanama,【C1】______shipsweeksoftimebymak
最新回复
(
0
)