C语言结构体单元练习 联系客服

发布时间 : 星期二 文章C语言结构体单元练习更新完毕开始阅读cae930a9ce2f0066f4332259

15、以下对枚举类型名的定义中正确的是 。

A) enum a={one,two,three}; B) enum a {one=9,two=-1,three}; C) enum a={\D) enum a {\16、下面程序的输出是 。

main()

{ enum team { my,your=4,his,her=his+10}; printf(\

A) 0 1 2 3 B) 0 4 0 10 C) 0 4 5 15 D) 1 4 5 15 17、下述程序的执行结果是 。 #include union un { int i; char c[2]; };

void main( ) { union un x; x.c[0]=10; x.c[1]=1;

printf(\}

A) 266 B) 11 C) 265 D) 138 17、有以下程序

#include struct node { int num;

struct node *next;}; main()

{ struct node *p,*q,*r;

p=(struct node *)malloc(sizeof(struct node)); q=(struct node *)malloc(sizeof(struct node)); r=(struct node *)malloc(sizeof(struct node)); p->num=10; q->num=20; r->num=30; p->next=q; q->next=r;

printf(\p->next->num); }

程序运行后的输出结果是 。

A) 10 B) 20 C) 30 D) 40 18、设有以下说明语句:

typedef struct { int n; char ch[8]; }per;

则下面叙述正确的是 。

A) per是结构体变量名 B) per是结构体类型名 C) typedef是结构体类型 D) struct是结构体类型名

19、若有以下定义:

struct link { int data;

struct link *next; }a,b,c,*p,*q;

且变量a和b之间已经有如右图所示的链表结构:指针p指向变量a,q指向变量c。能够把c插到a和b之间,并形成新的链表的语句组是 。

A) a.next=c;c.next=b; B) p.next=q;q.next=p.next; C) p->next=&c;q->next=p->next; D) (*p).next=q;(*q).next=&b;