首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #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-04-01
16
问题
有以下程序:
#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数组的第一个元素,所以p->x为20,然后p=p->y后,p指向数组a的第二个元素,所以输出15,选项D正确。
转载请注明原文地址:https://kaotiyun.com/show/r2kp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序#include<stdio.h>#include<string.h>voidmain(){charstr[][20]={"One*World","One*Dream!"),*p=str[1];printf("%d,",strlen
有以下程序#includemain(){charp[20]={’a’,’b’,’c’,’d’},q[]="abc",r[]="abcde";strcat(p,r);strcpy(p+str1en(q),q);
以下叙述中正确的是
以下叙述中正确的是
耦合性和内聚性是对模块独立性度量的两个标准。下列叙述中正确的是
有以下程序#includevoidfun(char*t,char*s){while(*t!=0)t++;while((*t++=*s++)!=0);}main(){charss[10
若有定义语句:doublex,y,*px,*py;执行px=&x;py=&y;正确的输入语句是
结构化程序由三种基本结构组成,三种基本结构组成的算法
设有定义语句“int(*f)(int);”则下列叙述中正确的是()。
随机试题
[背景资料]某施工单位承接的二级公路中有四道单跨2.0×2.0m钢筋混凝土盖板涵,在编制的《施工组织设计》中,对各涵洞的工序划分与工序的工作时间分析如表2B320020—1所示。施工单位最初计划采用顺序作业法组织施工,报监理审批时,监理
有n个进程都要使用某个共享文件,但系统限制最多可以有m个进程(n>m>1)同时读文件。用PV操作管理时,信号量的值不可能变化为
改革的特征是()。
Trainingastronauts______notaneasything.
妇女为防止非意愿妊娠的发生而采用的紧急避孕药物有()。
直接故意与间接故意的区别是:
依据《煤矿安全监察条例》,煤矿安全监察人员发现煤矿矿长或者其他主管人员违章指挥工人或者强令工人违章、冒险作业,应采取的措施是()。
关于矿山井下的防尘措施,说法错误的是()。
自行车比赛常见的场地赛项目有个人赛和()。
①在这种形势下,西方出现了青年现象的退潮,表现为批判能力的下降,青年人安于现状②现实呼吁青年精神的回归,无论解决问题的创造性,还是对历史使命的担当,希望还在青年③新的思想创造了青年,青年创造了新的时代④但从世界范围内来看,自从
最新回复
(
0
)