首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> #include "string.h" typedef struct{char name[9]; char sex;float score[2];}STU; void f(STU a) { STU
有以下程序 #include <stdio.h> #include "string.h" typedef struct{char name[9]; char sex;float score[2];}STU; void f(STU a) { STU
admin
2020-11-23
23
问题
有以下程序
#include <stdio.h>
#include "string.h"
typedef struct{char name[9]; char sex;float score[2];}STU;
void f(STU a)
{
STU b={"Zhao",’m’,85.0,90.0}; int i;
strcpy(a.name,b.name);
a.sex=b.sex;
for(i=0;i<2;i++) a.score
=b.score
;
}
程序的运行结果是
选项
A、Qian,m,85,90
B、Zhao,m,85,90
C、Zhao,f,95,92
D、Qian,f,95,92
答案
B
解析
本题考查在结构体中函数的实参和形参的传递,调用f(c)后,实参传向形参,进行f()函数功能的实现,但程序中没有返回语句,故形参不能将值传回实参,它们值的传递具有不可逆性,所与printf输出的还是c中实参的值。
转载请注明原文地址:https://kaotiyun.com/show/203p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列给定程序中,函数fun的功能是:读入一个字符串(长度
使用VC++2010打开考生文件夹下modi1中的解决方案。此解决方案的项目中包含一个源程序文件modi1.c。在此程序中,函数fun的功能是:先从键盘上输入一个3行、3列的矩阵的各个元素的值,然后输出主对角线元素之和。请改正程序中的错误,使它能得出正确
使用VC++2010打开考生文件夹下modi1中的解决方案。此解决方案的项目中包含一个源程序文件modi1.c。在此程序中,函数fun的功能是:根据整型参数m,计算如下公式的值。例如,若m=2000,则应输出0.000160。请改正程序中的错误,使它
下列给定程序中,函数fun的功能是:对N名学生的学习成绩,按从高到低的顺序找出前m(m≤10)名学生来,并将这些学生的数据存放在一个动态分配的连续存储区中,此存储区的首地址作为函数值返回。请改正程序中的错误,使它能得出正确的结果。注意:
有以下程序:#include<stdio.h>voidsp(int*a){intb=2;a=&b;*a=*a*2;printf(″%d,″,*a);}main(){intk=3,*p=&k;sp(p);printf(″%
请编写函数fun,其功能是:判断形参n中的正整数是几位数(输入数据的位数不超过4位),并将结果通过函数值返回。例如,若输入的数据为123,则输出结果为:输入的数字是3位。注意:请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编
以下针对全局变量的叙述中错误的是()。
某二叉树共有12个结点,其中叶子结点只有1个。则该二叉树的深度为(根结点在第1层)
设循环队列的存储空间为Q(1:35),初始状态为front=rear=35。现经过一系列入队与退队运算后,front=15,rear=15,则循环队列中的元素个数为
在关系数据库中,用来表示实体间联系的是()。
随机试题
患者半年前始觉下肢乏力,渐致不能任地,腰脊疲软,头晕耳鸣,口舌干燥,舌红少苔,脉沉细数,应选何方治疗
患者,男,67岁。有慢性胃病病史,近半年来食欲差,伴头晕,乏力。查:血红蛋白70g/L,红细胞1.8×1012/L,白细胞8×109/L,血清铁1000μg/ml。查体:贫血貌,牛肉舌,淋巴结及肝、脾均不大。该患者最可能的诊断是
环境的自净作用有三大作用方式,即
从疾病监测的角度,常规传染病报告属于
A.缩窄性心包炎B.心力衰竭C.肺动脉高压D.二尖瓣脱垂综合征E.二尖瓣狭窄
进食调节包括
患者女,48岁。发现右侧乳房内无痛性肿块1个月。体检:右侧乳房外上象限可扪及一直径约为5cm的肿块,表面不平滑,边界不清,质地硬;局部乳房皮肤凹陷呈酒窝征,同侧腋窝可扪及2个肿大的淋巴结,可被推动,经活组织病理学检查证实为乳癌,拟行乳癌改良根治术。
数据透视表不仅能够按照改变后的版面布局自动重新计算数据,而且能够根据更改后的原始数据或数据源来刷新计算结果。()
【2015.陕西汉中】下列关于遗忘规律表达不正确的是()。
中华文化有四个特点:统一性、连续性、多样性和__________。(对外经济贸易大学2016)
最新回复
(
0
)