首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序#include struct ord{int x,y;)dt[2]={1,2,3,4);main(){struct ord*p=dt; printf("%d",++(p->x))=printf("%d\n",++(p->y));} 程序运行后的
有以下程序#include struct ord{int x,y;)dt[2]={1,2,3,4);main(){struct ord*p=dt; printf("%d",++(p->x))=printf("%d\n",++(p->y));} 程序运行后的
admin
2019-06-09
19
问题
有以下程序#include struct ord{int x,y;)dt[2]={1,2,3,4);main(){struct ord*p=dt;
printf("%d",++(p->x))=printf("%d\n",++(p->y));}
程序运行后的输出结果是
选项
A、4,1
B、2,3
C、3,4
D、1,2
答案
B
解析
在题目中定义了结构体ord类型的数组变量dt,并对其赋初值。在程序中定义了指向结构体ord类型的指针变量p,并且它指向变量数组dt的第一个元素dt[0],所以此时成员变量p->x的值等于1,成员变量p->y的值等于2,在输出时分别加1,所以输出结果为选项B)。
转载请注明原文地址:https://jikaoti.com/ti/NDf0FFFM
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
给定程序的功能是:从键盘输入若干行文本(每行不超过80个字符),写到文件myfile4.txt中,用.1作为字符串输入结束的标志。然后将文件的内容读出显示在屏幕上。文件的读写分别由自定义函数ReadText和WriteText实现。请在程序的下划
学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组S中,请编写函数fun,它的功能是:函数返回指定学号的学生数据,指定的学号在主函数中输入。若没找到指定学号,在结构体变量中给学号置空串,给成绩置-1,作为函数值返回。(用于字符串比较的函数
编写函数fun,它的功能是计算:S作为函数值返回。在C语言中可调用log(n)函数求In(n)。log函数的引用说明是:doublelog(doublex)。例如,若m的值为:20,fun函数值为:6.506583。注
给定程序MODll.C中函数fun的功能是:将十进制正整数m转换成k(2≤k≤9)进制数,并按高位到低位顺序输出。例如,若输入8和2,则应输出1000(即十进制数8转换成二进制表示是1000)。请改正fun函数中的错误,使它能得出正确的
以下叙述错误的是()。
已知一个文件中存放若干工人档案记录,其数据结构如下:structa{charnumber[100];intage;floatp[6];};定义一个数组:structanumber[10];
负责数据库中查询操作的数据库语言是()。
下列关于二叉树的叙述中,正确的是()。
设有定义:inta=0,b=1,c=1;以下选项中,表达式值与其它三个不同的是()。
有以下定义:inta;longb;doublex,y;则以下选项中正确的表达式是()。
随机试题
E—R图向关系模型的转换
关于结合胆红素的叙述,哪一项错误
杀灭芽胞最可靠的方法是
烧伤深度的计算分为
下列有关资产负债表结构的相关说法中错误的是()。
学制
用6、3、0、9四个数字组成的最大的四位数是______,读作______;最小的四位数是______,接近______千.
《韩熙载夜宴图》的作者顾闳中为_______。
胡萝卜、西红柿和其他一些蔬菜含有番茄红素,番茄红素具有防止细胞癌变的作用。近年来W公司提炼出一些蔬菜中含有较丰富的番茄红素,并被制成片剂建议酗酒者服用,以防止酗酒可能引起的癌症。然而,意大利博罗尼亚大学和美国得克萨斯大学的科学家发现,经常服用番茄红素片剂反
ItisnoteasytotalkabouttheroleofthemassmediainthisoverwhelminglysignificantphaseinEuropeanhistory.Historyan
最新回复
(
0
)