首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include<stdio.h> struct tt{int x;struct tt *y;}*p; struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a}; main() { int i;
有以下程序: #include<stdio.h> struct tt{int x;struct tt *y;}*p; struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a}; main() { int i;
admin
2022-10-24
18
问题
有以下程序:
#include<stdio.h>
struct tt{int x;struct tt *y;}*p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{
printf("%d,",p->x);
p=p->y:
}
}
程序的运行结果是( )。
选项
A、20,30,
B、30,17
C、15,30,
D、20,15,
答案
D
解析
本题考查结构体变量的引用和结构体数组。结构体指针变量p指向数组a的第1个元素,所以“p->x”为20。执行“p=p->y”后,p指向数组a的第2个元素,所以输出15。故本题答案为D选项。
转载请注明原文地址:https://jikaoti.com/ti/8ad0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
使用VC++2010打开考生文件夹下prog1中的解决方案。此解决方案的项目中包含一个源程序文件prog1.c。在此程序中,请编写函数fun,其功能是:找出2×M整型二维数组中最大元素的值,并将此值返回调用函数。注意:部分源程序给出如下。
使用VC++2010打开考生文件夹下blank1中的解决方案。此解决方案的项目中包含一个源程序文件blank1.c。在此程序中,函数fun的功能是:将自然数1~10及其平方根写到名为myfile3.txt的文本文件中,然后再顺序读出显示在屏幕上。
使用VC++2010打开考生文件夹下blank1中的解决方案。此解决方案的项目中包含一个源程序文件blank1.c。在此程序中,函数fun的功能是:把形参a所指数组中的最大值放在a[0]中,接着求出a所指数组中的最小值放在a[1]中,再把a所指数组元素中的
C语言中允许用外部说明来指定变量、函数和其他标识符的特征,这里所说的外部指的是()。
下列排序方法中,最坏情况下比较次数最少的是( )。
学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组S中,请编写函数fun,它的功能是:把分数最高的学生数据放在h所指的数组中,注意:分数最高的学生可能不止一个,函数返回分数最高的学生的人数。注意:部分源程序在文件PROGl.C中
下列数据结构中,属于非线性结构的是()。
下列叙述中正确的是()。
计算机程序设计过程中,不属于结构化程序设计原则的是()。
下面不能作为结构化方法软件需求分析工具的是
随机试题
消防滤水器安装在进水管底部,用以阻止水藻、石子、杂草等物吸入()。
小隐静脉()
75岁女患者,右大腿卵圆窝部反复出现圆形突起已多年,此次因便秘突出包块增大,用力还纳后右下腹持续疼痛伴呕吐而求医。下腹压痛,反跳痛肌紧张,叩诊肝浊音界缩小,肠鸣音减弱。
《本草纲目拾遗》新增的药物种数是()。
胃大部切除术后出现贫血的原因是()
【2006年第88题】如图6-5所示,采用同类钢材制作的具有相同截面面积、相同截面高度(h)和腹板厚度,翼缘宽度不等的三种钢梁,当钢梁与上翼缘混凝土楼板整浇时,钢梁跨中截面的抗弯承载力大小顺序为下列哪项?(提示:混凝土强度、钢梁与楼板的连接、钢梁的稳定均有
证券市场的基本经济功能是()
某公司在生产主要产品的同时,还生产了某种副产品。该种副产品可直接对外出售,公司规定的售价为每千克100元。某月主要产品和副产品发生的生产成本总额为500000元,副产品的产量为500千克。假定该公司按预先规定的副产品的售价确定副产品的成本,则主产品应负担的
阅读材料,回答问题。材料一明清时期,形成了一个积累大量财富的商人群体——淮扬盐商。康乾年间,“奢靡风习创于盐商,而操他业以致富者群慕效之”,扬州地区物质繁荣,名流荟萃,周边乃至全国都追慕扬州,以至“作事轩昂,向日‘扬气’……尽事奢华也”。——摘编自
已知:x=-6y=39则表达式"y\x*Sgn(x)"的值为( )。
最新回复
(
0
)