//定义链表节点
int data;
struct LNode *next;
}LNode, *LinkList;
LinkList Head; //定义全局变量链表头
//构造空链表
LinkList InitList( )
{
static LinkList head;
head = (LinkList) malloc (sizeof(LNode));
if( ! head) exit (OVERFLOW);
head->next = NULL;
return head;
}
//输入数据插入到链表后,创建循环链表
Status CreateList(LinkList head ,int m)
{
LinkList p,q;
int i;
p = head;
for(i=1;i
q->data = i;
q->next = NULL;
p->next = q;
p = p->next;
if(i == m) { p->next = Head->next; } //链成循环链表
}
return OK;
}