首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #include <stdio.h> #include <stdlib.h> #include <string.h> struct stu { char *name, gender; int score; }; ma
若有以下程序 #include <stdio.h> #include <stdlib.h> #include <string.h> struct stu { char *name, gender; int score; }; ma
admin
2021-02-25
17
问题
若有以下程序
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct stu {
char *name, gender;
int score;
};
main()
{
struct stu a={NULL, ’m’, 290}, b;
a.name=(char *)malloc(10);
strcpy(a.name, "Zhao");
b = a; b.gender = ’f’; b.score = 350;
strcpy(b.name, "Qian");
printf( "%s,%c,%d,", a.name, a.gender, a.score );
printf( "%s,%c,%d\n", b.name, b.gender, b.score );
}
则程序的输出结果是
选项
A、Zhao,m,290,Zhao,f,350
B、Zhao,m,290,Qian,f,350
C、Qian,f,350,Qian,f,350
D、Qian,m,290,Qian,f,350
答案
D
解析
本题中考查结构体中变量的引用,a结构体中name被修改为Qian,所以本题答案为D。
转载请注明原文地址:https://kaotiyun.com/show/nntp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列给定程序中,函数fun的功能是:根据以下公式求π值,并作为函数值返回。例如,当给指定精度的变量eps输入0.0005时,应输出Pi=3.140578。π/2=1+1/3+1/3×2/5+1/3×2/5×3/7+1/3×2/5×3/
39.有以下程序:#include<stdio.h>#include<stdio.h>structS{charname[10];};voidchange(structS*data,intvalue){strcpy(data一>
有以下程序:#include<stdio.h>main(){inta=一1.b=一1:for(;++a;)++b;printf("%d%d\n",a,b);}程序运行后的输出结果是()。
以下叙述中正确的是()。
数据库设计中反映用户对数据要求的模式是()。
以下针对全局变量的叙述错误的是()。
有以下程序段:intm=33.n=66:m=m^n;n=n^m;m=m^n;执行上述语句后,m和n的值分别是()。
若实体A和B是一对多的联系,实体B和C是一对一的联系,则实体A和C的联系是
程序流程图中带有箭头的线段表示的是()。
对如下二叉树进行后序遍历的结果为
随机试题
国际私法
下列对上腭生理功能的描述,哪个是错的
依照《医疗事故处理条例》规定,医疗机构未制定有关防范和处理医疗事故的,应由卫生行政部门予以()
乙某于1999年3月因聚众斗殴罪被判刑3年,刑满释放后,经常夜间携带三棱刮刀到处游荡。2002年9月上旬,乙嫌这把三棱刮刀不锋利,又购买一把三棱刮刀带在身上,9月16日晚9时许,乙在当地一小卖部门前闲逛,遇见相识的周某、吴某、王某等人。周、吴等先后来向乙要
我国金融机构体系由构成。()
调节纳税人税收负担的纵向公平问题,税率形式多为( )。
房地产开发企业为建造自用办公楼取得土地使用权而支付的土地出让金不计入在建工程成本,应确认为存货。()
湖南省人口最多的少数民族是()。
回答问题1至问题3。
在C++语言中,数据封装要解决的问题是
最新回复
(
0
)