首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #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;
有以下程序 #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;
admin
2015-07-28
22
问题
有以下程序
#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,15,
B、30,17
C、15,30,
D、20,30,
答案
A
解析
语句"p=a;"将指针p指向了结构体数组a的首地址,此时p->x与a[0].x等价,值为20,执行语句"p=p->y;"则将指针p指向了a+1,即数组a第二个元素的地址,此时p->x与a[1].x等价,值为15,所以答案选A。
转载请注明原文地址:https://jikaoti.com/ti/DMn0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下程序的输出结果是______。main(){char*s="12134211”;intv[4]={0,0,0,0},k,i;for(k=0;s[k];k++){switch(s[k])
有以下函数 char*fun(char*p) {return p;} 该函数的返回值是______。
以下函数把b字符串连接到a字符串的后面,并返回a中新字符串的长度。请填空。surcen(chara[],charb[]){intnum=0,n=0;while(*(a+num)!=______)num++;wh
以下程序的输出结果是______。voidfun(){staticinta=0;a+=2;printf("%d",a);}main(){intcc;for(cc=1;cc<4;cc
以下程序段的运行结果是______。main(){chara=2,b=5;if(a&b)printf("YES");elseprintf("NO");}
设有说明语句:char a=’\72’;,则变量a______。
设有定义语句:char c1=92,c2=92;,则以下表达式中值为零的是______。
下列函数的功能是fun(char*a,char*B){while((*b=*A)!=‘\O’){a++;b++;}}
以下叙述正确的是
下面关于完全二叉树的叙述中,错误的是______。
随机试题
有关骨折断端移位的描述中不正确的有
关于铁的代谢,下列叙述错误的是
因探测器灵敏度不一致、采样系统故障造成的伪影形态是
A、安坤颗粒B、益母草膏C、七制香附丸D、妇科十味片E、少腹逐瘀丸用于治疗血虚肝郁所致月经不调的中成药是
于某缴纳了保证金,被取保候审后,由于违反有关规定,有关机关可以( )。
水泥混凝土拌和站基本组成一般不包括()。
统计分析是透过现象的质量表现来揭示现象的本质及其规律性,并预测其发展趋势的一种认识活动。()
计数调整型抽样检验更适用于()。
2014年7月至2015年3月美国出口额月平均增量是:
Whatisthemostimportantqualityforadogtrainer?
最新回复
(
0
)