找考题网-背景图
未分类题

下面程序的输出结果为( )。 struct st {int x;int *y;}*p; int dt[4]={10,20,30,40); struct st aa[4]={50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3]}; main() { p=aa; printf('%d/n',++p->x); printf('%d|n',(++p)->x); printf('%d/n',++(*p->y)); }
A.10 20 20
B.50 60 21
C.51 60 21
D.60 70 31

A.10
B.50
C.51
D.60

【参考答案】

C
解析:第1个输出语句中由于->的优先级高于++,因此先取结构体的分量x,再对x的值加1,再输出。p的初值为结构体数组aa的首地址即a[0]的地址,a[0]的x分量值为50,加1后输出51。第2个输出语句中++p被括号括起来,括号的优先级与->相同,自左至右结合,因此先对p加1,再取p所指...

(↓↓↓ 点击‘点击查看答案’看完整答案 ↓↓↓)
热门试题

未分类题Predictions of many robots in industry have yet come truE.For ten years or more, manufacturers of big robots have explained how their machines can make industry more competitive and productivE.The maker for 【21】______ robots is oversupplied now, and the driving force of the robotics (机器人学) revolution is 【22】______ to be with makers of machines that handle a few kilos at most.'Heavy-robot manufacturers are in some difficulty 【23】______ finding customer. They are offering big 【24】______ just to get in the door. There has been a 【25】______ growth everywhere in the numbers of robots, so we admit we are either deceiving 【26】______ or that the market is slowly growing. 'said John Reekie, chairman of Colen Robotics. 'The following things must happen 【27】______ the robotics revolution to occur. We must achieve widespread robot literacy, 【28】______ there has been a computer 【29】______ program, there must be a robot prices. 【30】______ , some kind of artificial intelligence needs to be 【31】______ .'Colen makes educational robots and machine tools. It is small 【32】______ with companies like ASEA or Fujitsu FanuC.But Colen with others and departments in universities such as Surrey, Manchester, and Durham possess an advantage 【33】______ . the giants. The big companies sell very expensive 【34】______ to businesses with expert knowledge in automation. The 【35】______ companies make robots for teaching people, and now they have realized that there is a need for small, 【36】______ robots that they can meet.The little companies either bring their educational machines 【37】______ an industrial standard or design from the start. One technique that they all adopt is to choose 【38】______ components where possiblE.The major cost of making 【39】______ their models is the electronics, which will fall in pricE.There is 【40】______ scope for reductions in mechanical costs. The sue of standard parts, which are easily replaced, should give these robots a mechanical life of something in the order of five years.【21】A.smallB.educationalC.bigD.business

A.B.'
C.
D.
【21】
A.small
B.educational
C.big