14.9 为了建立如图所示的存储结构(即每个结点含两个域,date是数据域,next是指向结点的指针域),请填空。
struct link
{ char data;
_________;
} node;
答案:struct link *next
14.10 以下MIN函数的功能是:查找带有头结点的单向链表中,结点数据域的最小值作为函数值返回。
请填空。
struct node { int data;
struct node *next;
};
int MIN(struct node *first)
{ struct node *p;
int m;
p=first->next;
m=p->data;
for(p=p->next; p!=\'\\0\'; p=_____)
if(______) m=p->data;
return m;
}
答案:p->next p->data 的头指针作为函数值返回。请填空。
#include "stdio.h"
struct list
{ char data;
struct list *next;
} ;
struct list *creat()
{ struct list *h,*p,*q;
char ch ;
h=_____malloc(sizeof(____));
p=q=h;
ch=getchar();
while(ch!=\'?\')
{ p=____malloc(sizeof(____));
p->data=ch;
q->next=p;
q=p;
ch=getchar();
}
p->next=\'\\0\';
________;
}
答案:(struct list *)、 struct list、 (struct list *)、 struct
list、 return h