首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
若有以下程序 #include #include typedef struct stu { char name[10], gender; int score; } STU; void f( char *p ) { strcpy( p, "
若有以下程序 #include #include typedef struct stu { char name[10], gender; int score; } STU; void f( char *p ) { strcpy( p, "
admin
2015-07-31
73
问题
若有以下程序
#include
#include
typedef struct stu { char name[10], gender;
int score;
} STU;
void f( char *p )
{ strcpy( p, "Qian" ); }
main()
{ STU a={"Zhao", ’m’, 290}, b;
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,m,290
C、Qian,f,350,Qian,f,350
D、Zhao,m,290,Zhao,f,350
答案
A
解析
本题考查结构体的相关操作以及传值、传址的区别,该题中调用f函数后,b的name会重新赋值为Qian,选项A正确。
转载请注明原文地址:https://kaotiyun.com/show/eIDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序的输出结果是________。main(){intk=4,m=1,p;p=func(k,m);printf("%d,",p);p=func(k,m);printf("%d\n",p);}
有以下程序段:intk=0;while(k=1)k++;while循环执行的次数是______。
下列叙述中正确的是()。
若a是int型变量,则下列表达式的值为______。(a=2*3,a*2),a+4
下列的for语句的循环次数为______。for(x=1,y=0;(y!=19)&&(x<7);x++);
软件生命周期分为软件定义期、软件开发期和软件维护期,详细设计属于______中的一个阶段。
已知函数fread的调用形式为fread(buffer,size,count,fp);其中buffer代表的是()。
下面的程序可列指定字符串中的字符串进行从大到小排序,请将程序填完整。(注:程序采用了冒泡排序算法)#include<stdio.h>#include<string.h>main(){char*str="ABCDabcd
要求使下列程序输出5个整数,请填空。for(i=0;i<=______;printf("%d\n",i+=2));
随机试题
某物品的年需求量为3000单位,物品的单位成本为12元,平均订货成本为20元/次,持有成本库存费用率为25%,则该物品的经济订购批量为()
调节血Ca2+浓度的激素有
痄腮热毒蕴结型的首选方是:
膀胱造影的方法不包括
短效口服避孕药含
教师的知识结构中,小学英语教师所拥有的英语学科知识属于()。
设f(x)有界,且f’(x)连续,对任意的x∈(-∞,+∞)有|f(x)+f’(x)|≤1.证明:|f(x)|≤1.
Inrecentyearsmanycountriesoftheworldhavebeenfacedwiththeproblemofhowtomaketheirworkersmoreproductive.Some
SheisoneofthefewpeoplehereIcanunderstandproperly;shepronouncesallherwordsso______.
Evenamodestamountofstepsisassociatedwithlowermortality.
最新回复
(
0
)