首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include #include structA { int a;char b[10];double c;}; void f(structA t); main() {structAa=
有以下程序 #include #include structA { int a;char b[10];double c;}; void f(structA t); main() {structAa=
admin
2019-12-17
27
问题
有以下程序
#include
#include
structA
{ int a;char b[10];double c;};
void f(structA t);
main()
{structAa={1001,"ZhangDa",1098.0};
f(a);printf("%d,%s,%6.1f\n",a.a,a.b,a.c);}
void f(struct A t)
{t.a=1002;
strcpy(t.b,"ChangRong");
t.c=1202.0;}
程序运行后的输出结果是
选项
A、1002,ChangRong,1202.0
B、1001,ChangRong,1098.0
C、1001,ZhangDa,1098.0
D、1002,ZhangDa,1202.0
答案
C
解析
本题主要考查是的函数调用时参数之间的传递问题。在C语言中参数之间的传递是传值,也就是把实参的值复制一份传递给形参,而实参的值不发生变化。所以对于本题来说,在主函数中执行f(a),把结构体变量a的值复制一份传递给形参变量t,而实参变量a的值保持不变。
转载请注明原文地址:https://kaotiyun.com/show/ihCp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序#include<stdio.h>main(){inta=1,b=0;printf("%d",b=a+b);printf("%d\n",a=2*b);}程序运行后的输出结果是
以下叙述中正确的是
以下叙述中正确的是
设有定义:chars[81];inti=0;以下不能将一行(不超过80个字符)带有空格的字符串正确读入的语句或语句组是
以下叙述中错误的是
以下关于C语言数据类型使用的叙述中错误的是
下列给定程序中,函数fun的功能是:将形参a所指数组中的前半部分元素中的值与后半部分元素中的值对换。形参11中存放数组中数据的个数,若n为奇数,则中间的元素不动。例如,若a所指数组中的数据为:1,2,3,4,5,6,7,8,9,则调换后为:6,7,8,9
编写函数fun,其功能是:实现两个字符串的连接(不要使用库函数strcat),即把p2所指的字符串连接到p1所指的字符串的后面。例如,分别输入下面两个字符串:“FirstString--”“SecondString”程序输出:“FirstStri
从工程管理角度看,软件设计一般分为两步完成,它们是
数据库设计中,用E—R图来描述信息结构但不涉及信息在计算机中的表示,它属于数据库设计的
随机试题
甲公司是一家区别于传统火锅店方式的火锅餐饮企业,在给顾客提供餐饮服务的同时,还免费给顾客提供擦鞋、美甲、擦拭眼镜等服务。甲公司的经营模式取得了成功,营业额高速增长。甲公司实施蓝海战略的路径是()。
下述哪项支持Alport综合征的诊断
休克早期急性肾衰竭的发生机制主要是
增感屏的相对感度指的是
下列局麻药中,酯类局麻药是()。
某建设项目建设期是3年,其贷款分年拨付,三年贷款额分别为320万元、450万元、500万元,年利息率为7%,建设期内利息只计息不支付,则该项投资的建设期贷款利息是()万元。
下列关于压力开关的说法中,正确的是()。
增值税专用发票只限于增值税一般纳税人领购使用,增值税小规模纳税人不得领购使用。普通发票主要由营业税纳税人和增值税小规模纳税人使用。()
教师之间“谦虚谨慎,尊重同志,相互学习,相互帮助,维护其他教师在学生中的威信;关心集体,维护学校荣誉,共创文明校风”。这是师德教育的()。
“三个代表”重要思想是对党的性质、宗旨、根本任务的新概括,是对马克思主义建党学说的新发展。()
最新回复
(
0
)