首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #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
19
问题
若有以下程序
#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://jikaoti.com/ti/bbz0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序:#include<stdio.h>structord{intx,y;}dt[2]={1,2,3,4};main(){structord*p=dt;printf("%d,"++p一>x):printf("%d
某二叉树有5个度为2的结点,则该二叉树中的叶子结点数是()。
有以下程序:#include<stdio.h>main(){inti,*ptr:intarray[5]={5,3.1};for(ptr=array,i=0;i<5:i++,ptr++){if(*ptr==0)
以下选项中错误的是()。
有以下程序:#incIude<stdio.h>main()inta:a=(int)(—1.53*3):printf("%d\n",a);}程序的运行结果是()。
有以下程序(字母A的ASCII代码为65):#include<stdio.h>main(){charcl='A',c2='Y':printf("%d%d\n",c1,c2);}程序运行后的输出结果是()。
设有如下语句:typedefstructDate{intyear;intmonth;intday;}DATE;则以下叙述中错误的是()。
下列定义数组的语句中,正确的是()。
下面结构体的定义语句中,错误的是()。
下列排序方法中,最坏情况下比较次数最少的是
随机试题
Lessthanayearago,anewgenerationofdietpillsseemedtoofferthelong-soughtanswertoourchronicweightproblems.Hund
A.麻疹B.流行性脑脊髓膜炎C.幼儿急疹D.伤寒E.流行性出血热女孩,8个月。发热、呕吐半天,抽搐1次,体检:体温39.2℃,面色苍白,嗜睡,胸、腹邢等处皮肤有瘀点和瘀斑,前囟1cm×1cm,略饱满。可能的诊断为
以下说法错误的是
A.肝素B.枸橼酸钠C.EDTAK2D.草酸铵E.双草酸盐适用于血小板计数的抗凝剂为
某公司是一家成立时间不长,但发展迅速的民营公司。随着市场拓展和员工数量的增加,公司新近成立了人力资源部,希望能专业化地开展人员的聘用和绩效考核等工作,解决人员配置和绩效管理等方面存在的突出问题。人力资源部张经理认为,要解决人力资源管理方面的问题,首先要开展
军队属于政府会计主体,核算时适用于政府会计基本准则。()
初中音乐欣赏课《卡门序曲》中,教师由情境创设法引入本节课主题《卡门序曲》,和学生一起将音乐完整地聆听2遍,并介绍了音乐背景和曲式结构,请学生一起学习了西班牙舞蹈,留下开放作业,请学生回家之后聆听其他乐章。上述案例当中,教师的课程当中缺少了()环节。
某企业购入一台设备作为固定资产,用于生产应征增值税的产品,则以下不计入该固定资产原始成本的是()。
【B1】【B12】
BuildaTeamCreatingtherightteamisimperativetoyoursuccess.Ateamiscomprisedofpeoplewhocanbringnecessarysk
最新回复
(
0
)