首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #include #include #include typedefstructstu{ char*name,gender; intscore; }STU; voidf(char*p) { p=(char*)malloc(10); strcp
若有以下程序 #include #include #include typedefstructstu{ char*name,gender; intscore; }STU; voidf(char*p) { p=(char*)malloc(10); strcp
admin
2015-07-31
13
问题
若有以下程序
#include
#include
#include
typedefstructstu{
char*name,gender;
intscore;
}STU;
voidf(char*p)
{
p=(char*)malloc(10);
strcpy(p,"Qian");
}
main()
{
STUa={NULL,’m’,290},b;
a.name=(char*)malloc(10);
strcpy(a.name,"Zhao");
b=a;
f(b.name);
b.gender=’f’;b.score=350;
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,Qian,f,350
B、Zhao,m,290,Zhao,f,350
C、Qian,f,350,Qian,f,350
D、Qian,m,290,Qian,f,350
答案
B
解析
本题考查结构体变量中的引用,其中a的name为Zhao,b执行函数f(b.name)后b的name并没有改变,还是Zhao,所以答案为B选项。
转载请注明原文地址:https://kaotiyun.com/show/kBDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若a、b、c、d都是int型变量且都已经正确赋初值,则下列不正确的赋值语句是()。
下列程序的运行结果是______。#include<stdio.h>main(){intfun();fun();}fun(){staticinta[4]={1,2,3,4);inti:for(i:0;
字符(char)型数据在微机内存中的存储形式是______。
已知字母A的ASCII码值是65,字母a的ASCII码值是97,以下程序______。main(){chara=’A’;intb=20;printf(%d,%0",(a=a+a,a+b,B),a+’a’-’A’,B);}
下面语句的输出结果是______。printf("%d\n",strlen("\t\"\065\xff\n"));
整型变量x和Y的值相等,且为非0值,则以下选项中结果为0的表达式是______。
下列叙述中,错误的是()。
在位运算中,操作数每右移两位,其结果相当于()。
若已经定义的函数有返回值,则以下关于该函数调用的叙述中错误的是______。
数据库DB、数据库系统DBS、数据库管理系统DBMS之间的关系是()。
随机试题
子宫颈管或它的外口周围感染后引起发炎称为宫颈炎,有急性与慢性之分,其中慢性炎症更为常见。关于宫颈糜烂下列哪项不正确
在西南南方面。汉武帝先后派________、________、________三次通使西南夷。
A、注意力缺陷,活动过度B、中枢性运动障碍,姿势异常C、发热呕吐,脑膜刺激征阳性,进行性休克D、以精神和意识障碍为突出表现E、肢体某一部分抽搐、不伴意识障碍中枢性脑瘫表现为
苏合香的功效有
以下哪项不属立体异构对药效的影响
办事处在民法上属于()。如果会计师事务所向法院起诉时以宏海公司为被告,但未申明有仲裁协议,宏海公司()。
(2006年考试真题)根据支付结算法律制度的规定,存款人日常经营活动的资金收付,以及工资、奖金和现金的支取,只能通过规定的账户办理。该账户是()。
已知圆C1:(x-2)2+(y-3)2=1,圆C2:(x一3)2+(y一4)2=9,M,N分别是圆C1,C2上的动点,P为x轴上的动点,则|PM|+|PN|的最小值为()
赫尔巴特认为“教学永远具有教育性”。
A、Thepreparatoryyear.B、Professionally-orientedcourse.C、Coursesatthelanguageschools.D、Firstdegreecourses.A选项A是预科年,选项
最新回复
(
0
)