问题 填空题

[说明]
下面的程序是通过双链结构来查找学生的信息程序的一部分,即创建双向链表部分。
[函数]
#include <stdio.h>
#define N 10
typedef struct node

char name [20];
struct node *llink,*rlink;
stud; /*双链表的结构定义*/
/*双链表的创建*/
stud * creat (int n)

stud *p,*h,*s;
int i;
if ((h= (stud *) malloc (sizeof (stud))) ==NULL)

printf ("cannot find space! \n") ;
exit (0) ;

h->name[0]=’\0’;
h->llink=NULL;
h->rlink=NULL;
p=h;
for(i=0; i<n; i++)

if((s= (stud *) malloc (sizeof (stud)))==NULL)

printf ("cannot find space! \n") ;
exit (0) ;

(1) ;
printf("Please input the %d man’s name: ";i+1) ;
scanf("%s", s->name) ;
(2) ;
(3) ;
p=s ;

(4) ;
(5) ;
return (h) ;

答案

参考答案:p->rlink=s

单项选择题 A1/A2型题
单项选择题