首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> #include <string.h> typedef struct stu { char name[10]; char
有以下程序 #include <stdio.h> #include <string.h> typedef struct stu { char name[10]; char
admin
2020-06-16
49
问题
有以下程序
#include <stdio.h>
#include <string.h>
typedef struct stu {
char name[10];
char gender;
int score;
} STU;
void f(char *name, char *gender, int *score)
{ strcpy(name, "Qian");
*gender = ’f’;
*score = 350;
}
main( )
{ STU a = {"Zhao", ’m’, 290}, b;
b = a;
f(b.name, &b.gender, &b.score);
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、Zhao,m,290,Qian,m,350
D、Zhao,m,290,Qian,m,290
答案
A
解析
main函数中,首先定义两个结构体stu类型的变量a,b,把a成员信息复制给b成员后,再调用函数f(),在f()函数中,利用指针重新对b成员信息进行赋值,分别输出a,b成员信息,答案为A选项。
转载请注明原文地址:https://kaotiyun.com/show/IdCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序:#includemain(){intx=1,y=0;if(!x)y++;elseif(x==0)if(x)y+=2:elsey+=3;printf("%d\n",y)
关于C语言标识符,以下叙述中错误的是()。
C源程序中不能表示的数制是()。
以下叙述中错误的是()。
有以下程序:#include<stdio.h>main(){inta=2,c=5;printf("a=%%db=%%d\n",a,c);}程序运行后的输出结果是()。
有以下程序:#include<stdio.h>#defineN2#defineMN+1#defineNUM(M+1)*M/2main(){printf("%d\n",NUM);}程序运行后的
有如下程序:#include<stdio.h>#include<string.h>main(){chara[]="1234",*b="ABC";printf("%d%d%d%d\n",strlen(a
若有以下程序:#include<stdio.h>charfun(charx){returnx*x+’a’;}main(){chara,b=0;for(a=0;a<4;a+=1){b=f
若有以下程序:#include<stdio.h>main(){inta=一11,b=10;a%=b%=4;printf("%d%d\n",a,b);}则程序的输出结果是()。
随机试题
山东省济南市人民政府为加强市容管理,向该市人大常委会提出制定《市容管理条例》的议案,该市人大常委会审议认为,可先由市人民政府制定《市容管理暂行办法》。则该暂行办法中规定下列哪些行政处罚是合法的?()
左下颌第三磨牙冠周炎并发面颊瘘的常见位置相当于左下颌的
根据《麻醉药品和精神药品管理条例》的规定,将含可待因复方口服液体制剂(包括口服溶液剂、糖浆剂)列入
犯罪嫌疑人李某在侦查阶段会见其辩护律师张某时,声称自己在讯问时被刑讯逼供。张某可采取的正确做法是()。
存款客户向存款机构提供的转账凭证或填写的存款凭条是()。
CISC与RISC的区别表现在()。
JimandBillplaywithafrisby.JimthrowsthefrisbytoBill.BillthrowsthefrisbytoJimandJimcatchesit.Theydon’tsee
A、 B、 C、 C
Thepricesofallthesharesfellsharplyjustafterafew______whenthenewscamethatthewarhadbrokenout.
Themostconsistentlyidentifiedteachereffectivenessvariableistimeontask.Thatis,themoretimethatstudentsspendon
最新回复
(
0
)