#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node *next;
} LNode, *LinkList;
/*
* 若需要经常对表头或表尾进行操作,可以让l指向尾结点
*/
int InitList() {
LNode *l = (LNode *)malloc(sizeof(LNode));
if (l == NULL) return -1;
l->next = l;
return 1;
}
int Empty(LinkList l) {
if (l->next == l) return 1;
else return -1;
}
int isTail(LinkList l, LNode *p) {
if (p->next == l) return 1;
else return -1;
}
网友评论