c primer plus 第十七章课后编程2题
/ 把程序清单17.3使用下面的定义: / typedef struct list { Node *head; / 指向list的开头 / Node *end; / 指向list的末尾 / }List; / 不用修改主函数,只修改了程序清单17.5中的函数以适应新的定义,所以只发修改的list.c / #include “list.h” #include <stdio.h> #include <stdlib.h> / 局部函数原型 / static void CopyToNode(Item item, Node *pnode); / 接口函数 / / 把链表设置为空 / void InitializeList(List *plist) { plist = NULL; } / 如果链表为空,返回true / bool ListIsEmpty(const List *plist) { if(plist == NULL) return true; else return false; } / 如果链表已满,返回true / bool ListIsFull(const List *plist) { Node *pt; bool full; pt = (Node *)malloc(sizeof(Node)); if(NULL==pt) full = true; else full =