首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include struct tt { int x;struct tt*y;)*p; struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a}; main() {
有以下程序: #include struct tt { int x;struct tt*y;)*p; struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a}; main() {
admin
2021-04-28
20
问题
有以下程序:
#include
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
解析
本题考查的是指针和结构的应用。首先定义的数组tt中有两个成员,一个整型变量,一个结构指针。当i=1时,p指针指向结构数组的第一个元素,并输出此元素的第一个成员x.即20;当i=2时,p指针指向结构数组的第二个元素的第一个成员,所以输出15。
转载请注明原文地址:https://kaotiyun.com/show/N3tp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
若有定义inta;floatb;doublec;程序运行时输入:345能把值3输入给变量a、4输入给变量b、5输入给变量c的语句是
有以下程序#includevoidfun(char*t,char*s){while(*t!=0)t++;while((*t++=*s++)!=0);}main(){charss[10]="acc",aa[10]="bbxxyy";fun(s
已有定义:charc;,程序前面已在命令中包含ctype.h文件。不能用于判断c中的字符是否为大写字母的表达式是
以下选项中不合法的标识符是( )。
请编写函数fun,它的功能是:求出1到1000之间能被7或11整除、但不能同时被7和11整除的所有整数并将它们放在a所指的数组中,通过n返回这些数的个数。注意:部分源程序在文件PROG1.C中。请勿改动主函数main和其他函数中的任何内容,仅在函数fu
学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fun,它的功能是:按分数的高低排列学生的记录,高分在前。注意:部分源程序在文件PROG1.C文件中。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括
学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组S中,请编写函数fun,它的功能是:函数返回指定学号的学生数据,指定的学号在主函数中输入。若没找到指定学号,在结构体变量中给学号置空串,给成绩置-1,作为函数值返回。(用于字符串比较的函数
下列关于数据库设计的叙述中,正确的是
下面不属于软件测试实施步骤的是()。
随机试题
关于胆汁的叙述,错误的是
“壮水之主,以制阳光”是指
建筑电气方案设计文件中,照明系统对于特殊建筑,如大型体育场馆、大型影剧院等,有条件时应绘制照明平面图。该平面图应包括灯位(含应急照明灯)、灯具规格,配电箱(或控制箱)位,不需连线。()
某工程的早时标网络计划如图6—4所示。工程进展到第5、第10和第15个月底时,分别检查了工程进度,相应地绘制了三条实际进度前锋线,如图6—4中的点划线所示。注:1.图中每根箭线上方数值为该项工作每月预算成本;2.图下方格内
广义的财政管理体制主要包括()。
公有制经济特别是国有经济的主要实现形式是()。
在冬季,室内温度经常低于(),企业应采取防寒保温措施。
试述家庭教育的基本要求。
(1)将考生文件夹下HARE\DOWN文件夹中的文件EFLFU.FMP设置为存档和只读属性。(2)将考生文件夹下WID\DEIL文件夹中的文件ROCK.PAS删除。(3)在考生文件夹下HOTACHI文件夹中建立一个新文件夹DOWN。(4)将考生文件夹
A、Lookintoanotherpassenger’seyes.B、Signalyouarenotathreattoanyone.C、Keepadistancefromotherpassengers.D、Avoid
最新回复
(
0
)