首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #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
58
问题
有以下程序:
#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全国计算机二级
相关试题推荐
有下列程序:voidf(int*q){inti=0;for(;i<5;i++)(*q)++;}main(){inta[5]={1,2,3,4,5},i;f(a);for(i=0;i<5;i++)printf("%d,",a[i]);}
下列叙述中正确的是
某完全二叉树按层次输出(同一层从左到右)的序列为ABCDEFGH。该完全二叉树的前序序列为()。
下面属于整数类I的实例的是
由以下while构成的循环,循环体执行的次数是intk=0;while(k=1)k++;
有以下程序:#include<stdio.h>voidf(intb[]){inti;for(i=2;i<6;i++)b[i]*=2;}main(){inta[10]={1,2,3,4,5,6,7,8,9,10},i;f(a);
有以下程序#includemain(){inti,j,m=1;for(i=1:i0;j--){if(i*j>3)break;m*=i*j;}}printf("m=%d\n
在结构化方法中,用数据流程图(DFD)作为描述工具的软件开发阶段是()。
流程图是描述算法的很好的工具,一般的流程图中由几种基本图形组成。其中输入输出框的图形是()。
在关系数据库设计中,关系模式设计属于()。
随机试题
议论文的核心要素是()
Whenyouhavecompletedyourcollegeeducation,youwilllookforajobsuitedtoyourtraining,interests,andambition.Inmos
下列不是CT扫描注意事项的是
下列各项中,会引起所有者权益总额发生增减变动的是()。(2007年)
下列关于日食的表述不正确的是()。
中东路事件
试析柏拉图的教育思想。
Todaywearesurethatthemailwillbesenteverydaytoourdoor.Butintheearlydays,noonecouldbesureaboutwhere—orw
Choosethecorrectletter,A,BorC.Inthecloakroom,peopleareadvisednottoleave
A、Aphenomenonofanagingfacebecauseofpeoplefacingacomputerforalongtime.B、Afeatureofascreen-shapefacebecause
最新回复
(
0
)