有以下结构体说明和变量的定义,且如图14-4所示的指针p指向变量a,指针q指向变量b。则不能把结点b连接到结点a之后的语句是______。
struct node { char data; struct node * next; }a,b,*p=&a,*q=&b:
A.a.next=q;
B.p.next=&b;
C.p->next=&b;
D.(*p).next=q;
第1题:
有以下结构体说明和变量定义,如图所示,指针p、q、r分别指向此链表中的三个连续节点。 struct node {int data;struct node*next;}*P,*q,*r; 现要将q所指节点从链表中删除,同时要保持链表的连续,
以下不能完成指定操作的语句是( )。
A.p->next=q->next;
B.p->next=P->next->next;
C.p->next=r;
D.p=q->next;
第2题:
有以下结构体说明和变量的定义,且指针p指向变量a,指针q指向变量b。则不能把节点b连接到节点a 之后的语句是
struct node
{ char data;
struct node*next;
}a,b,*p= &a,*q=&b;
A.a. next=q;
B.p. next= &b;
C.p->next=&b;
D.(*p).next=q;
第3题:
有以下程序段
typedef struct node { int data; struct node *next; } *NODE;
NODE p;
以下叙述正确的是
A)p 是指向 struct node 结构变量的指针的指针
B)NODE p ;语句出错
C)p 是指向 struct node 结构变量的指针
D)p 是 struct node 结构变量
第4题:
有以下结构体说明和变量定义,如图所示,指针p、q、r分别指向一个链表中的三个连续结点。
struct node
{ int data;
struct node *next;
} *p, *q, *r;
现要将q和r所指结点的先后位置交换,同时要保持链表的连续,以下错误的程序段是
A.r->next=q; q->next=r->next; p->next=r;
B.q->next=r->next; p->next=r; r->next=q;
C.p->next=r; q->next=r->next; r->next=q;
D.q->next=r->next; r->next=q; p->next=r;
第5题:
有以下结构体说明和变量的定义,且指针p指向变量a,指针q指向变量b。则不能把结点b连接到结点a之后的语句是
struct node
{ char data;
struct node *next;
} a,b,*p=&a,*q=&b;
A.a.next=q;
B.p.next=&b;
C.p->next=&b;
D.(*p).next=q;
第6题:
以下程序的功能是:建立一个带布头结点的单向链表,并将存储在数组中的字符依次存储到链表的各个结点中,请从与下划线处号码对应的一组选项中选择出正确的选项
#include <stdlib.h>
struct node
{char data; struct node *next;};
(48) CreatList(char*s),
{struct node *h,*p,*q;
h=(struct node*)malloc(sizeof(struct node));
p=q=h;
while(*s!="\0")
{ p=(struct node*)malloc(sizeof(struct node));
p->data= (49) ;
q->next=p;
q= (50) ;
s++;
}
p->next="\0";
return h;
}
main()
{ char str[]="link list";
struct node*head;
head=CreatList(str);
…
}
(1)
A.char*
B.struct node
C.struct node*
D.char
第7题:
若有以下定义:
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;
第8题:
有以下程序段 typedef struct node { int data; struct node *next; } *NODE; NODE p; 以下叙述正确的是( )。
A.p是指向struct node结构变量的指针的指针
B.NODE p;语句出错
C.p是指向struct node结构变量的指针
D.p是struct node结构变量
第9题:
以下定义的结构体类型拟包含两个成员,其中成员变量info用来存入整形数据;成员变量link是指向自身结构体的指针,请将定义补充完整。
struct node
{ int info;
【19】link;
};
第10题:
若有以下定义: 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;