首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #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
有以下程序: #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
admin
2021-02-25
23
问题
有以下程序:
#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/tntp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序:#include<stdio.h>intml(intx,inty){returnx<=y?x:y;}intm2(intx,inly){returnx<=y?y:x;}intfun(inta,intb){re
以下选项中错误的是()。
有以下程序:#include<stdio.h>main(){intx=1,y=0;if(!x)y++;elseif(x==0)y+=2;elsey+=3;printf("%d\n",y);}程序运行
编写一个函数,该函数可以统计一个长度为2的字符串在另一个字符串中出现的次数。例如,假定输入的字符串为"asdasasdfgasdaszx67asdmklo",子字符串为"as",则应当输出6。注意:请勿改动主函数main和
下列各序列中不是堆的是()。
若要求从键盘读入含有空格字符的字符串,应使用函数
当没有指定C语言中函数形参的存储类别时,函数形参的存储类别是()。
字符数组a和b中存储了两个字符串,判断字符串a和b是否相等,应当使用的是()。
数据库系统的三级模式不包括
“商品”与“顾客”两个实体集之间的联系一般是
随机试题
对于性激素合成哪项不正确
《三因极—病证方论》所论述的五瘿是
案情:田某和苗某是前后院邻居,田某家盖的房子挡住了苗某家的采光,苗某多次交涉,田某不听,反将苗某打成重伤,田某被逮捕。在刑事诉讼过程中,苗某为提起附带民事诉讼,委托本市某律师事务所律师胡某为其诉讼代理人。胡律师接受委托后,为苗某写了如下诉状:刑事附带民事
土地总登记通告的内容主要包括()。
对摩擦型桩,当承台面积一定时,桩数n增加,则群桩效应系数()。
2010年以后,各大商业银行逐渐取消了住房贷款的优惠利率。北京、上海都出台了房屋限购令。中国人民银行也在年内5次上调存款准备金率。中国人民银行也在3年内首次加息。根据以上材料,回答下列问题:此举的政策含义是()。
下列选项中作品及其主要人物对应有误的一项是()。
西安自古以来就有“八水绕长安”之说,为历代文人学士所称道。下列不属于八水的是()。
阅读以下说明,回答问题1~问题4,将解答填入答题纸对应的解答栏内。(2009年5月下午试题一)【说明】某公司拥有一个C类地址块212.253.115.0/24,网络拓扑结构如图4—6所示。在PC1的DOS命令窗口中,运行ar
Energydrinksareastapleamongcollegestudentsandclubkids,andthey’reevenbecomingubiquitousinmanyAmerican【C1】______
最新回复
(
0
)