C Primer Plus课后编程题答案.doc

C Primer Plus课后编程题答案.doc

第17章 高级数据表示 编程练习 1.修改程序清单17.2,使其既能以正序又能以逆序显示电影列表。一种方法是修改链表定义以使链表能被双向遍历;另一种方法是使用递归。 #include stdio.h #include stdlib.h #include string.h #define TSIZE 45 struct movie{ char name[TSIZE]; int rating; struct movie *next; struct movie *former; }; void CreateMovies(struct movie **phead, struct movie **pend); void DisplayOriginal(struct movie *head, struct movie *end); void DisplayReverse(struct movie *head, struct movie *end); void FreeMoives(struct movie *head, struct movie *end); int main(void) { struct movie *head = NULL, *end = NULL; CreateMovies(head ,end); DisplayOriginal(head,en

文档评论(0)

1亿VIP精品文档

相关文档