首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> #include <string.h> struct A { int a; char b[10]; double c; }; struct A f(struct A t);
有以下程序 #include <stdio.h> #include <string.h> struct A { int a; char b[10]; double c; }; struct A f(struct A t);
admin
2021-02-25
15
问题
有以下程序
#include <stdio.h>
#include <string.h>
struct A
{
int a;
char b[10];
double c;
};
struct A f(struct A t);
main()
{
struct A a={1001,"ZhangDa",1098.0};
a=f(a);
printf("%d,%s,%6.1f\n",a.a,a.b,a.c);
}
struct A f(struct A t)
{
t.a=1002;
strcpy(t.b,"ChangRong");
t.c=1202.0;
return t;
}
程序运行后的输出结果是
选项
A、1002,ZhangDa,1202.0
B、1002,ChangRong,1202.0
C、1001,ChangRong,1098.0
D、1001,ZhangDa,1098.0
答案
B
解析
本题考查结构体变量的引用以及作为函数参数,题目虽然看似复杂,其实比较容易,f函数的参数是结构体变量,然后对参数重新赋值并返回,所以该题目的答案为B选项。
转载请注明原文地址:https://kaotiyun.com/show/Botp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
数据库系统的核心是
以下不能将s所指字符串正确复制到t所指存储空间的是
下面选项中的程序段,没有编译错误的是
两次执行下面的程序,如果从键盘上分别输入4和2,则输出结果是()。main(){intx;scanf("%d\n",&x);ifi(x++>3)printf("%d\n",x);elsepri
以下叙述中正确的是
有以下程序main(){inti,j;for(i=1;i
设二叉树的后序序列为DGHEBIJFCA,中序序列为DBGEHACIFJ。则前序序列为
关于字符串的叙述中正确的是()。
以下函数按每行8个输出数组中的数据:voidfun(int*wintn){inti;for(i=0;i<n;i++){______________printf("%d".w[i]);}printf("\n
设表的长度为n。在下列算法中,最坏情况下时间复杂度最高的是
随机试题
梯形图两边的两条竖线就是电源。()
乙烯氧化生产环氧乙烷工艺中所选用的催化剂为银,抑制剂为二氯乙烷()。
用于表示开工或完工的相邻工序在时间上的分界点的是【】
A、呼吸衰竭B、循环衰竭C、头痛、腰痛、眼眶痛D、皮肤瘀点、瘀斑E、相对缓脉属于流行性出血热典型表现的是
A.肾盂癌B.前列腺癌C.急性膀胱炎D.急性肾盂肾炎E.前列腺增生症
病史中最主要的部分是
根据证券法律制度的规定,下列主体中,对招股说明书中的虚假记载承担无过错责任的是()。
中国注册会计师执业准则体系包括鉴证业务准则、相关服务准则和会计师事务所质量控制准则。下列关于鉴证业务准则的叙述错误的是()。
所有的战争和混乱都是在没有协商、无理可讲的时候发生的,讲理和协商都离不开语言,然而,并非有语言的地方就自动会有说理,有语言的地方必须有自由才能有说理。由此可以推出()。
假定一个处理器正在执行3道作业,Ⅰ作业以计算为主,Ⅱ作业以输入/输出为主,Ⅲ作业以计算与输入/输出为主。应该如何赋予它们占有处理器的优先级,使得系统效率较高?
最新回复
(
0
)