首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include<stdio.h> #include<string.h> typedef struct{ char name[9]; char sex; float score[2];}STU; void f(STU*a) { strcpy(
有以下程序: #include<stdio.h> #include<string.h> typedef struct{ char name[9]; char sex; float score[2];}STU; void f(STU*a) { strcpy(
admin
2020-01-10
21
问题
有以下程序:
#include<stdio.h>
#include<string.h>
typedef struct{
char name[9];
char sex;
float score[2];}STU;
void f(STU*a)
{
strcpy(a->name,"Zhao");
a->sex=’m’:
a->score[1]=90.0;
}
main()
{
STU c={"Qian",’f’,95,92.0},*d=&c;
f(d);
printf("%s,%c,%2.0f,%2.0f\n",
选项
A、Qian,f,95,92
B、Zhao,f,95,90
C、Zhao,m,95,90
D、Zhao,f,95,92
答案
C
解析
f函数调用时,结构体数组名作为实参传给了形参指针,使结构体指针a指向了数组c的首地址。因此,f持有了主函数中数组c的指针,可以对数组c中的元素赋值,故返回主函数之后,数组c中的成员值已被更新。
转载请注明原文地址:https://kaotiyun.com/show/pUCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列给定程序中,函数fun的功能是:根据整型参数m,计算如下公式的值。例如,若m=2000,则应输出0.000160。请改正程序中的错误,使它能得出正确的结果。注意:部分源程序在文件MODI1.C中,不要改动main函数,不得增行或删行,也不得更改
下列给定程序是建立一个带头结点的单向链表,并用随机函数为各结点赋值。函数fun的功能是将单向链表结点(不包括头结点)数据域为偶数的值累加起来,并且作为函数值返回。请改正函数fun中的错误,使它能得出正确的结果。注意:部分源程序在文件MODI1.C中,不
函数fun的功能是:将两个两位数的正整数a、b合并成一个整数放在c中。合并的方式是:将a数的十位和个位数依次放在c数的千位和十位上,b数的十位和个位数依次放在c数的百位和个位上。例如,当a=45,b=12时,调用该函数后C=4152。注意:部分源程序给
请编写函数fun,其功能是:找出2×M整型二维数组中最大元素的值,并将此值返回调用函数。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。试题程序:#defineM4#inc
下列给定程序中,函数fun的功能是:把形参a所指数组中的最小值放在元素a[0]中,接着把a所指数组中的最大值放在a[1]元素中;再把a所指数组元素中的次小值放在a[2]中,把a所指数组元素中的次大值放在a[3],依此类推。例如,若a所指数组中的数据最初排
若变量已正确定义并赋值,则以下符合C语言语法的表达式是()。
运行下面的程序,输入字符串“MicrosoftVisualStudio”,则程序的执行结果是()。#include<stdio.h>main(){charChr[20];scanf(’’%s’’,&Ch
若变量已正确定义,以下选项中非法的表达式是
设二叉树的前序序列与中序序列均为ABCDEFGH,则该二叉树的后序序列为
随机试题
某企业拟筹资金实施一项技术改造项目,内容为新建一套加工装置,该装置建设投资25000万元,计算期6年(建设期1年,运营期5年),新装置所需流动资金5000万元,全部运营期第1年投入。假设该装置投资所含增值税可在其建设期内由原企业抵扣,忽略其带来的影响。新装
排水固结法分为堆载预压法和真空预压法两类,用于加固()。
黄疸消退后调治肝脾不调证的代表方剂是( )
A.骨髓巨核细胞增多伴成熟障碍B.骨髓巨核细胞增多无成熟障碍C.骨髓巨核细胞明显减少D.骨髓原始巨核细胞≥0.30(非红系细胞)E.骨髓可见较多的小巨核细胞原发性血小板增多症()
人身保险合同中由投保人指定的,在保险事故发生后享有保险赔偿与保险金请求权的人是()。
注重以服务对象为中心,创造一种有利于服务对象自我发展的辅导环境的个案工作模式是()。
阅读下面文字,回答有关问题:《普通高中化学课程标准(实验)》中有这样的表述:结合人类探索物质及其变化的历史与化学科学发展的趋势,引导学生进一步学习化学的基本原理和基本方法,形成科学的世界观。问题:结合高中化学某一内容的教学,举例说明如何借助化学史开
A、 B、 C、 D、 D黑点个数每次增加2,圆圈个数每次减少2。
恩格斯说:“……他用这本书来向自然事务方面的教会权威挑战。从此自然科学便开始从神学中解放I叶j来……”。引文中的“他”和“这本书”指的是()。
简述人本主义心理学的基本观点。
最新回复
(
0
)