首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include <stdio.h> struct STU { char name[10]; int num; }; void f1(struct STU c) { struct ST
有以下程序: #include <stdio.h> struct STU { char name[10]; int num; }; void f1(struct STU c) { struct ST
admin
2009-01-15
19
问题
有以下程序: #include <stdio.h> struct STU { char name[10]; int num; }; void f1(struct STU c) { struct STU b={"LiSiGuo",2042}; c=b; } void f2(struct STU *c) { struct STU b={"SanDan",2044}; *c=b; } main() { struct STU a={"YangSan",2041}, b={"WangYin",2043}; f1(a); f2(&b); printf("%d%d\n",a.num,b.hum); } 执行后的输出结果是( )。
选项
A、2041 2044
B、2041 2043
C、2042 2044
D、2042 2043
答案
1
解析
f2函数传递的是变量的地址,可以实现数据的交换,而f1函数传递的是值,调用完 f1函数后,c的值改变了,但main函数中的a值并未改变。
转载请注明原文地址:https://kaotiyun.com/show/LpHp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
在考生目录下有一个工程文件vbsj5.vbp,用来计算勾股定理整数组合的个数。勾股定理中3个数的关系是:a2+b2=c2。例如,3、4、5就是一个满足条件的整数组合(注意:a,b,c分别为4,3,5与分别为3,4,5被视为同一个组合,不应该重复计算)。编写
在考生文件夹下有一个工程文件sjt5.vbp,窗体上有三个文本框,其名称分别为Text1、Text2和Text3,其中Text1、Text2可多行显示。请添加三个命令按钮,名称分别为Cmd1、Cmd2和Cmd3,标题分别为“产生数组”、“统计”和“退出”,
在考生文件夹下有一个工程文件sjt.vbp,功能是用来计算勾股定理整数组合的个数。勾股定理中3个数的关系是:a2+b2=c2。例如,3、4、5就是一个满足条件的整数组合(注意:a,b,c分别为4,3,5与分别为3,4,5被视为同一个组合,小应该重复计算)。
在窗体上画一个文本框,其名称为Text1,初始内容为空白,并设置成多行显示格式;然后再画两个命令按钮,其名称分别为Command1和Command2,标题分别为“显示”和“保存”,如图3-92所示,编写适当的事件过程。程序运行后,如果单击“显示”按钮,则读
在考生文件夹下有一个工程文件sjt5.vbp,窗体如图所示。运行程序时,从考生文件夹数据文件中读取学生的成绩(均为整数)。要求编写程序,统计总人数,同时统计不及格、60~69、70~79、80~89及90~100各分数段的人数,将统计结果显示在相应的文本框
在考生文件夹下有一个工程文件sjt5.vbp,其窗体上有2个标题分别是“读数据”和“统计”的命令按钮,1个名称为Text1的文本框,2个标签控件,如图3—31所示。程序功能如下:1)单击“读数据”按钮,则将考生文件夹下in5.dat文件的内容(该文件中
(1)考生文件夹下有工程文件sjt3.vhp,控件及其属性见窗体文件。程序功能为:单击窗体,则先把数据集读入数组arr,再根据用户输入的值删除数组中对应的元素,并提示操作结果。删除元素分为三步完成:首先查找到要删除的元素,其次将其后续元素顺次前移
请根据以下各小题的要求设计VisualBasic应用程序(包括界面和代码)。(1)在名称为Form1,标题为“图书”的窗体上画1个名称为Cmb1的下拉式组合框。下拉列表中有“少儿读物”“传记文学”和“武侠小说”3个表项内容。运行后的窗体如错误!
下列可以打开随机文件的语句是
随机试题
WhatdowemeanbyaperfectEnglishpronunciation?Inone【C1】______thereareasmanydifferentkindsofEnglishasthereares
患者女,56岁。进行性吞咽困难1个月余,体重近来明显减轻,伴声嘶,无胸痛或背痛,无饮水呛咳,查体:浅表淋巴结未及明显肿大。超声内镜检查:食管距门齿24~27cm见一溃疡,食管病灶处全层低回声增厚,最厚处8.0mm,累及固有基层,外膜层完整。食管23cm处壁
CPR时正确的操作程序是
具有结肠带、结肠袋、肠脂垂结构的器官是
关于热原质,错误的是
Jurgens甲基紫染色法结果正确的是
A、氯化铵B、溴己新C、右美沙芬D、色甘酸钠E、倍氯米松反射性地引起呼吸道腺体分泌的是
已知液化石油气气相的各组分质量成分为:gC3H8=50%,gC4H10=50%,在标准状态下的平均动力黏度为()。[各组分的动力黏度(10-6Pa·s)为:C3H8=7.65,C4H10=6.97]A.2.147×10-6Pa·sB.5.168
如果资本市场是完全有效的,下列表述中错误的是()。
某窗体中有一命令按钮,在窗体视图中单击此命令按钮打开另一个窗体,需要执行的宏操作是()。
最新回复
(
0
)