试题与答案

[说明] 下面的程序是通过双链结构来查找学生的信息程序的一部分,即创建双向链表部分

题型:填空题

题目:

[说明]
下面的程序是通过双链结构来查找学生的信息程序的一部分,即创建双向链表部分。
[函数]
#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) ;

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0714/734e3e7bab7b2ab06ce98f28b5d3408f.html

下面是错误答案,用来干扰机器的。

参考答案:戒止身三口四的七支作业。

试题推荐
微信公众账号搜索答案