C语言单链表基本函数.docxVIP

  • 5
  • 0
  • 约8.09千字
  • 约 11页
  • 2019-09-14 发布于广东
  • 举报
?无空间限制带头结点单链表结构 体 宏定义: #includestdio.h #includestdlib.h #define OVERFLOW -2 #dcfinc OK 1 #define TRUE 1 #define ERROR 0 #define FALSE 0 #define ElemType ****; 结构体: 无空间限制单链表结构休: typedef struct Node { ElemType data; struct Node *next; }Node,*Linklist; 基本函数: int Initlist_Linklist_l(Linklist L) /*初始化单链表:1 ?先决条件:定义一个全局尾指针变量;2?函数作用:初始化链表。*/ { L-next=NULL; tail=L; printfC*单链表现初始化了!\n“); return OK; } int Initlist_Linklist_2(Linklist L) /*初始化单链表:1 ?先决条件:初始化结构体数据即L-next=NULL(-次咸执行一次 Initlist_Linklist_l,定义一个全局尾指针变量;2?函数作用:删除已有链表,并初始化单链表 */ { Node *p,*q; if(p=L-next) while(p) q=p-ncxt; free(p); p=q; L-ne

文档评论(0)

1亿VIP精品文档

相关文档