网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
若有以下程序段,则以下表达式中值为2的是()。struct dent { int no; int *m; }; int a=1,b=2,c=3; struct dent s[3]={{101,&a},{102,&b},{103,&c}}; int main() { struct dent *p; p=s; … }
A.(p++)->m
B.* (p++)->m
C.(*p).m
D.*(p)->m
参考答案和解析
编译不通过
更多 “若有以下程序段,则以下表达式中值为2的是()。struct dent { int no; int *m; }; int a=1,b=2,c=3; struct dent s[3]={{101,a},{102,b},{103,c}}; int main() { struct dent *p; p=s; … }A.(p++)->mB.* (p++)->mC.(*p).mD.*(p)->m” 相关考题
考题
有以下程序struct S {int n; int a[20];};void f(struct S *P){ int i,j,t;for(i=0;ip-n-1;i++)for(j=i+1;jp-n;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;is.n;i++) printf("%d",s.a[i]);}程序运行后的输出结果是A)1,2,3,4,5,6,7,8,9,10,B)10,9,8,7,6,5,4,3,2,1,C)2,3,1,6,8,7,5,4,10,9,D)10,9,8,7,6,1,2,3,4,5,
考题
有以下程序struct S {int n; int a[20];}; void f(struct S *P) {int i,j,t; for(i=0;in-1;i++) for(j=i+1;jn;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 printf(“%d”,s.a[i]); } 程序运行后的输出结果是( )。 A.1,2,3,4,5,6,7,8,9,10,B.10,9,8,7,6,5,4,3,2,1,C.2,3,1,6,8,7,5,4,10,9,D.10,9,8,7,6,1,2,3,4,5,
考题
下列语句段中,正确的是( )。A.struct{int x;float y;int a[2];unsigned b[3];char name[10];};B.struct stu{unsigned a[3];unsigned b[4];}x;int*p=x.a;C.struct stu{int a;float x[4];}y={1,1.0};float data=y.x;D.struct nd{int a,b;unsigned c[2]=5;};
考题
C数组名称是指针变量吗?
看这段程序,可是执行。#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; struct info *p=aa; for(int i=0;i3;i++,p++) printf("%-6s %d\n",p-name,p-age);}将其改成这样:#include stdio.hint main(int argc, char *argv[]){ struct info { char name[33]; int age; }; struct info aa[3]={"meng",20,"juan",29,"an",59}; //struct info *p=aa; for(int i=0;i3;i++,aa++) printf("%-6s %d\n",aa-name,aa-age);}为什么就执行不了呢
考题
有以下程序:#includestruct stu { int num;char name[10];int age;}void fun(struct stu*p){ printf(%s\n,(*p).name);}main{ struct stu students[3]={{9801,Zhang.20}, {9802,Wang,19},{9803,Zhao,1 8}}fun(students+2); }输出的结果是( )。A.ZhangB.ZhaoC.WangD.18
考题
下列程序的输出结果是( ) struct abc { int a,b,c;}; main() { struct abc s[2]={{1,2,3},{4,5,6}}; int t; t=s[0].a+s[1].b; printf("%d\n",t); }A.3B.4C.5D.6
考题
若有以下定义的语句: struct student { int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() { struct student *p; p=stu; …} 则以下不正确的引用是( )。A.(p++)->numB.p++C.(*p).numD.P=stu.age.
考题
下列程序的输出结果是()。includestruct abc{int a, b, c, s;};main(){struct abc s[2]
下列程序的输出结果是( )。 #include <stdio.h> struct abc { int a, b, c, s;}; main() { struct abc s[2]={{1,2,3},{4,5,6}}; int t; t=s[0].a+s[1].b; printf("%d\n",t); }A.5B.6C.7D.8
考题
以下程序的输出是______。 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 {int num; float TotalScore;
有以下程序: #include <strino.h> struct STU {int num; float TotalScore; }; void f(struct STU p) {struct STU s[2]={{20044,550},{20045,537}}; p.num=s[1].num;p.TotalScore=s[1].TotalScore; } main() {struct STU s[2]={{20041,703},{20042,580}}; f(s[0]); printf("%d%3.0t\n",s[0].num,s[0].TotalScore); } 程序运行后的输出结果是 ______。A.20045 537B.20044 550C.20042 580D.20041 703
考题
有以下程序: 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,
考题
若有以下程序段: struct st {int n; int*m: }; int a=2,b=3,c=5; struct st s[3]=({101,a},{102,c},{103,B)}; main() {struct st*p; p=s; } 则以下表达式中值为5的是( )。A.(*p).mB.*(p+1)->mC.*(p++)->nD.(p++)(*m)
考题
以下程序运行后的输出结果是【 】。struct NODE{int num;struct NODE *next;};main(){struct NODE s[3]={{1,'\0'},{2,'\0'},{3,'0'}},*p,*q,*r;int sum=0;s[0].next=s+1;s[1].next=s+2;s[2].next=s;p=s; q=p->next; r=q->next;sum+=q->next->num; sum+=r->next->next->num;printf("%d\n",sum);}
考题
若有以下程序段: struct st {int n; int*m;}; int a=2,b=3,c=5; struct st s[3]=({101,a},{102,c},{103,b}}; main() {struct st*p; p=s; …} 则以下表达式中值为5的是( )。A.(p++)->mB.*(p++)->mC.(*p).mD.*(++p)->m
考题
有以下程序: include struct NODE{ int num; struct NODE*next; } main() {structNOD
有以下程序:#include<stdlib.h>struct NODE{int num;struct NODE *next;}main(){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(Struct NODE *)malloc(sizeof(struct NODE));r=(Struct NODE *)malloc(sizeof(struct NODE));p->num=1; q->num=2; r->num=3;p->next=q; q->next=r; r->next=NULL;sum+=q->next->num;sum+=p->num;printf("%d\n",sum);}执行后的输出结果是( )。A.3B.4C.5D.6
考题
有以下程序 include struct NODE{ int num; struct NODE *next;}; main( )
有以下程序#include <stdlib.h>struct NODE{int num;struct NODE *next;};main( ){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf(“%d\n”,sum);}执行后的输出结果是A.3B.4C.5D.6
考题
设有以下程序: struct st{int n;struct st *next;}; static struct st a[3]={5,a[1],7,struct st *next;}; static struct st a[3]={5,a[1],7,a[2],9,'\0'},*p; p=a [0]; 下面选项中,表达式值为6的是______。A.p++->nB.p->n++C.(*p).n++D.++p->n
考题
若有以下定义和语句 struct a{ int n,m;}; struct a st[3]={{2,3},{4,5},{6,7}}; struct a*p=st;则以下错误的引用是A.(p++)-n; B.st[0].n; C.(*p).n; D.P=st.m,
考题
有以下程序: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
考题
有以下程序: #includestdio.h struct stu { int num; char name[10]: int age;} void fun(struct stu*p) {printf("%s\n",(*p).name);} the main { struct stu students[3]={{9801,"Zhang".20}, {9802,"Wang",19},{9803,"Zhao",1 8}} fun(students+2); } 输出的结果是( )。A. ZhangB.ZhaoC.WangD.18
考题
以下程序的输出结果是______。includestruct stu{int num; char name[10]; int age;};v
以下程序的输出结果是______。#include<stdio.h>struct stu{ int num; char name[10]; int age;};void fun(struct stu*p){ printf("%s\n",(*p).name);}main(){ struct stu students[3]={ {9801,"Zhang",20}, { 9802,"Wang",19}, { 9803,"Zhao",18} }; fun(students+2);}A.ZhangB.ZhaoC.WangD.18
考题
有以下程序 inGlude struct NODE { int num; struct NODE *next; } main() {struct N
有以下程序#inGlude<stdlib.h>struct NODE {int num;struct NODE *next;}main(){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(stnlct NODE*)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next;r;r->next=NULL;sum+=q->next->Num,sum+=p->num;printf("%d\n",sum);}执行后输出结果是A.3B.4C.5D.6
考题
若有以下定义和语句 struct a { int n,m;}; struct a st[3]={{1,20},{2,19},{3,21}}; struct a*p=st; 则以下错误的引用是A.(p++)->n;B.st[0].n;C.(*p).n;D.p=st.m;
考题
有以下程序: include struct NODE{int nurn;struct NODE *next; }; main() { struct
有以下程序:#include <stdlib.h>struct NODE{int nurn;struct NODE *next;};main(){ struct NODE *p,*q,*r;int sum=0;P=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;Printf("%d\n",sum);}执行后的输出结果是( )。A.3B.4C.5D.6
考题
单选题有以下程序#include struct S{ int n; int a[20];};void f(struct S *p){ int i,j,t; for(i=0;in-1;i++) for(j=i+1;jn;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
A
1,2,3,4,5,6,7,8,9,10,B
10,9,8,7,6,5,4,3,2,1,C
2,3,1,6,8,7,5,4,10,9,D
10,9,8,7,6,1,2,3,4,5,
考题
单选题有以下函数:#include struct stu{ int num; char name[10]; int age;};void fun(struct stu *p){ printf(%s, p-name);}main(){ struct stu x[3] = {{01,Zhang,20}, {02,Wang,19}, {03,Zhao,18}}; fun(x+2);}程序运行后的输出结果是( )。A
ZhangB
ZhaoC
WangD
19
考题
单选题若有以下程序段struct st{ int n; struct st*next;};struct st a[3] = {5,a[1],7,a[2],9,'\0'}, *p;p = a[0];则以下选项中值为6的表达式是( )。A
p-n++B
(*p).nC
++(p-n)D
p-n
热门标签
最新试卷