有以下说明语句:struct Student{int num;double score;};Student stu[3]={{1001,80},{1002,75},{1003,91}},*p=stu;则下面引用形式错误的是()
第1题:
有以下说明和定义语句 struct student { int age;char num[8]; struct student stu[3]={{20,"200401"},{21,"200402"},{19,"200403"}}; struct student *p=stu;}; 以下选项中引用结构体变量成员的表达式错误的是
A.(p++)->num
B.p->num
C.(*p).num
D.stu[3].age
第2题:
设有以下说明语句 struct num { int a; float b; }numl;则下面的叙述不正确的是______。
A.struct是结构体类型的关键字
B.struct num是用户定义的结构体类型
C.numl是用户定义的结构体类型名
D.a和b都是结构体成员名
第3题:
( 38 )有以下定义和语句
struct workers
{ int num;char name[20];char c;
struct
{ int day; int month; int year; } s;
} ;
struct workers w,*pw;
pw = &w;
能给 w 中 year 成员赋 1980 的语句是
A ) *pw.year = 198O;
B ) w.year=1980;
C ) pw->year=1980;
D ) w.s.year=1980;
第4题:
下列对结构及其变量定义错误的是( )。
A.struct My Struct
B.struct MyStruct{ {int num; int num;char ch; char ch;} }My;
C.strut
D.struct{ {int num; int num;char ch; char ch;}My; };
第5题:
若有以下定义的语句: struct student { int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() { struct student *p; p=stu; …} 则以下不正确的引用是( )。
A.(p++)->num
B.p++
C.(*p).num
D.P=&stu.age.
第6题:
若有以下定义的语句 struct student {int age; int num;}; struct student stu[3]={{1001,20},{1002,19},{1003,21}}; main() {stmct student *p; p=stu; …} 则以下不正确的引用是
A.(p++)->num
B.p++
C.(*p).num
D.P=&stu.age.
第7题:
此题为判断题(对,错)。
第8题:
设有如下说明typedef struct{ int number; char class;double score;}student;则以下选项中,能正确定义结构体数组并赋初值的语句是( )。A.student tt[2]={{189,’A’,62},{190,’B’,75}};B.student tt[2]={189,’"A",62,190,"B",75};C.struct tt[2]={{189,’A’},{190,’B’}};D.struct tt[2]={{189,"A",62.5},{190,"B",75.0}};
第9题:
有以下程序:
#inClude <stdlib.h>
struct NODE{
int num;
struct NODE *next;
};
main()
{ Struct N00E *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.3
B.4
C.5
D.6
第10题:
有以下程序: #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 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041