首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include typedef struct stu { char name[10]; char gender; int score; } STU; void f(STU c) { strcpy(c.name, "Qi
有以下程序 #include #include typedef struct stu { char name[10]; char gender; int score; } STU; void f(STU c) { strcpy(c.name, "Qi
admin
2015-07-28
34
问题
有以下程序
#include
#include
typedef struct stu {
char name[10];
char gender;
int score;
} STU;
void f(STU c)
{ strcpy(c.name, "Qian");
c.gender = ’f’;
c.score = 350;
}
main()
{ STU a={"Zhao", ’m’, 290}, b;
b=a;
f(b);
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,m,290
B、Zhao,m,290,Qian,m,290
C、Zhao,m,290,Qian,m,350
D、Zhao,m,290,Qian,f,350
答案
A
解析
结构体变量作为函数参数为值传递,形参变量的变化不能影响实参变量的变化,所以函数f(b)调用结束后,b的值没有改变,和a一致,所以输出结果为选项A)。
转载请注明原文地址:https://kaotiyun.com/show/8KJp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
已有文本文件test.txt,其中的内容为:Iamthewinner!。以下程序中,文件test.txt已正确为“读”而打开,由文件指针fr指向该文件,则程序的输出结果是______。main(){FILE*fr;charstr
以下正确的程序段是______。
下面程序的运行结果是______。 #include<stdio.h> #include<string.h> fun(char*w,int n) { char t,*s1,*s2; s1=w;s2=w+n-1; while(s1<s2) {t=*s1++;
以下程序的输出结果是______。 int d=1; fun (int p) { static int d=5;d+=p; printf("%d",d);return(d); } main() {int a=3;printf("d\n",fun(a+fun
下面能正确进行字符串赋值操作的语句是______。
下列字符序列中,不可用作C语言标识符的是______。
以下叙述中正确的是______。
设有定义:structperson{intID;charname[12];}P;请将scanf(“%d”,【】);语句补充完整,使其能够为结构体变量P的成员ID正确读人数据。
下列叙述中正确的是()。
随机试题
《我与地坛》的抒情方式有( )
计算
属非必需氨基酸的是
下列融资工具,按风险由小到大排列,正确的排列顺序是()。
中国古代主要国号的由来有几种情况,下面属于以封爵定国号的是()。
左边给定的是纸盒的外表面,下面哪一项能由它折叠而成?
如图,有一个11位数,它的每3个相邻数字之和都是20,则标有*的那个数位上的数字应是几?
马克思主义认为,人的全面发展只有在()才能真正实现。
设随机变量X~U(0,1),Y~E(1),且X,Y相互独立,求Z=X+Y的密度函数fZ(z).求X1和X2的联合概率分布;
InanEnglishvillagenotfarfromLondon,Oliverandtwentyotherpoorchildrenlivedinorphan’shome.TheyhadtheirMealsin
最新回复
(
0
)