以下C语言程序的输出结果是( )。struct s{int x,y;}data[2]={10,100,20,200};main( ){struct s*p=data;p++;printf(“%d\n”,++(p->x));}A.10B.11C.20D.21

以下C语言程序的输出结果是( )。struct s{int x,y;}data[2]={10,100,20,200};main( ){struct s*p=data;p++;printf(“%d\n”,++(p->x));}

A.10
B.11
C.20
D.21

参考解析

解析:data是s类型的数组,即结构体数组,用{10,100,20,200}赋值,可知:data[0].x=10data[0].y=100data[1].x=20data[1].y=200struct s*p,p是data数组的指针。指向数组的第一个元素,*p即为data[0]。p++之后,即地址向后移动,此时p指向数组的第二个元素,*p即为data[1].p->x和(*p).x是一样的,p->x和data[1].x等价。所以在++(p->x)之后,data[0].x的值变为21。输出21。

相关考题:

有以下程序#include stdio.hstruct st{ int x,y;} data[2]={1,10,2,20};main(){ struct st *p=data;printf("%d,",p-y); printf("%d\n",(++p)-x);}程序的运行结果是A)10,1B)20,1C)10,2D)20,2

有以下程序:struct s{ int x,y; }data[2]={10,100,20,200};main(){ struct s *p=data;printf("%d\n",(++p)-x);}程序运行后的输出结果是( )。A.10 B.11 C.20 D.21

执行下列程序后,输出的结果是()。includedefine S(X)X*Xvoid main(){int a=9,k=3,m=2; 执行下列程序后,输出的结果是( )。 #include<stdio.h> #define S(X)X*X void main() { int a=9,k=3,m=2; a/=S(k+m)/S(k+m); printf("%d",a); }A.(*p) .data.aB.(*p) .a;C.p->data.aD.p.data.a

有以下程序}struct s{ int x,y; } data[2]={10,100,20,200};}main( )}{ struct s *p=data;}printf("%d\n",++(p->x));}程序运行后的输出结果是A.10B.11C.20D.21

以下程序的输出结果是______。 struct HAR {int x,y;struct HAR *p;}h[2] main() { h[0].x=1;h[0].y=2 h[1].x=3;h[1].y=4 h[0].p=h[1];h[1].p=h printf("%d%d\n",()h[0].p)->x,(h[1].p->y); }A.12B.23C.14D.32

以下程序的输出是______。 struct st {int x;int*y; }*p; int dt[4]={10,20,30,40}; struct st aa[4]={50,dt[0],60,dt[1],60,dt[2],60,dt[3]}; main() { p=aa; printf("%d\n",++(p->X)); }A.51B.11C.50D.60

有以下程序: include struct STU (char name[10]; int num; }; 有以下程序: #include <string.h> struct STU (char name[10]; int num; }; void f(char *name, int num) {struct STU s[2]={{"SunDan",20044}.{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() {struct STU s[2]={{"YangSall",20041},{"LiSiGao",20042}},*p;p=s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); } 程序运行后的输出结果是 ______。A.SunDan 20042B.SunDan 20044C.LiSiGuo 20042D.YangSan 20041

有以下程序 include struct tt { int x; struct tt *y; } *p; s 有以下程序 #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,17C.15,30,D.20,15,

有以下程序:includestruct tt{int x;struct tt*y;}*p;struct tt a[4]={20,a+1,15,a+2, 有以下程序: #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,17C.15,30D.20,15

有以下程序includestruct ord{ int x,y;} dt[2]={1,2,3,4};mare(){struct ord*p=dt; p 有以下程序 #include<stdio.h> struct ord { int x,y;} dt[2]={1,2,3,4}; mare() { struct ord*p=dt; printf("%d,",++p->x); printf("%d\n",++p->y); } 程序的运行结果是______。A.1,2B.2,3C.3,4D.4,1

有以下程序 include struct st { int x,y;} data[2]={1,10,2,20}; main( 有以下程序 #include <stdio.h> struct st { int x,y;} data[2]={1,10,2,20}; main() { struct st *p=data; printf("%d,",p->y); printf("%d\n",(++p)->x); } 程序的运行结果是______。A.10,1B.20,1C.10,2D.20,2

下面程序的输出结果为( )。 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 20B.50 60 21C.51 60 21D.60 70 31

有以下程序:includestruct tt{ int x;struct tt *y;} *p;struct tt a[4]={20,a+1,15,a 有以下程序: #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,17C.15,30,D.20,15,

有以下程序#include stdio.hstruct st{ int x, y, z;} data[2]={3,10,2,20,15,7};main(){ struct st *p=data; printf("%d,", p-y); printf("%d\n",(++p)-x); }程序的运行结果是A.10,3 B.20,3 C.10,20 D.20,2

有以下程序#includestdio.hstruct S{int a,b;} data[2]={10,100,20,200};main(){struet S p=data[l];printf(“%d\n”,++(P.a)):}程序运行后的输出结果是A.10B.11C.20D.21

以下程序的输出结果是______。 struct HAR {int x,y;struct HAR*p;}h[2]; main() { h[0].x=1;h[0].y=2; h[1].x=3;h[1].y=4; h[0].p=h[1];h[1].p->y); printf("%d%d\n",(h[0].p)->x,(h[1].p)->y); }A.12B.23C.14D.32

有以下程序:#includestdio.hstruct S{int a,b;)data[2]=10,100,20,200);main( ){struct S p=data[l];printf(%d\n,++(p.a));}程序运行后的输出结果是( )。A.10B.11C.20D.21

有以下程序:struct S{int n;int a[20];};void f(struct S*P){int i,j,t;for(i=0;in-1;i++)fo 有以下程序: struct S{int n;int a[20];}; void f(struct S*P) { int i,j,t; for(i=0;i<P->n-1;i++) for(j=j+1;j<P->n-1;j++) if(p->a[i]>p->a[j]) {t=P->a[i];p->a[i]=P->a[j];p->a[j]=t} } main() {int i;struct S s{10,{2,3,1,6,8,7,5,4,10,9}}; f(&s); for(i=0;i<s.n;i++)printf("%d",s.a[i]);} 程序运行后的输出结果是( )。A.3B.4C.5D.6

以下程序的输出结果是includestruct st{ int x;int *y;}*p;int dt[4]={10,20,30,40};s 以下程序的输出结果是 #include<stdio.h> struct st { int x;int *y;}*p; int dt[4]={10,20,30,40}; struct st aa[4]={50,dt[0],60,dt[0],60,dt[0],60,dt[0],}; main() { p=aa; printf("%d\n",++(p->x));}A.10B.11C.51D.60

以下程序的输出结果是( )。include struct s { int x,y; } a[2]={10,100,20,200}; main() { struct s *p=data; printf("%d\n",++(p->x)); } A、10B、11C、20D、21

以下程序的输出结果是()。includestruct st{int x;int*y;}*p; int dt[4] ={ 10,20,30,4 以下程序的输出结果是( )。 #include<stdio.h> struct st { int x; int *y;} *p; int dt[4] ={ 10,20,30,40 }; struct st aa[4]={ 50,dt[0],60,dt[0],60,dt[0],60,dt[0]}; main() { p=aa; printf("%d\n",++(p->x)); }A.10B.11C.51D.60

以下程序的输出结果是 ( ) struct st { int x; int * y;} * p; int dt[4]={10,20,30,40}; struct st aa[4]={50,dt[0],60, dt[0],60 dt[0],60,dt [0]}; main( ) { p=aa; printf("%d\n",+ +(p->x)); }A.10B.11C.51D.60

(38)有以下程序#include stdio.hstruct S{ int a,b;}data[2]={10,100,20,200};main(){ struct S p=data[1];printf("%d\n",++(p.a));}程序运行后的输出结果是A)10B)11C)20D)21

单选题有以下程序:#include struct S{ int a,b;}data[2]={10,100,20,200};main(){ struct S p=data[1]; printf(%d,++(p.a));}程序运行后的输出结果是(  )。A10B11C20D21

单选题有以下程序:#include struct S{ int x,y;};main(){ struct S data[3] = {4,3,2,0,8,1}; int i; for(i=0;i3;i++)  printf(%d%d;,data[i].x, data[i].y1); printf();}程序运行后的输出结果是(  )。A41;20;80;B41;22;64;C40;21;80;D43;20;81;

单选题有以下程序:#include struct st{ int x,y;} data[2]={1,10,2,20};main(){ struct st *p=data; printf(%d,,p-y); printf(%d,(++p)-x);}程序运行的结果是(  )。A10,1B20,1C10,2D20,2

单选题有如下程序:#include struct S{ int x,y;};main(){ struct S data[2] = {4,3,1,9}; int i; for(i=0;i2;i++)  printf(%d,%d;,data[i].x, data[i].y1);}程序运行后的输出结果是(  )。A4,1;1,4;B4,1;2,4;C4,3;1,9;D4,3;2,3;