1.头文件
#include<stdio.h>
#include<stdlib.h>
typedef struct Link{
int data;
struct Link *next;
}link;
2.功能函数
link *link_init(void)
{
link *p = (link *)malloc(sizeof(link));
p->next = p;
return p;
}
//头插
void link_insert(link *head,int value)
{
link *node = (link *)malloc(sizeof(link));
node->next = head->next;
head->next = node;
node->data = value;
}
//尾插
void link_Insert(link *head,int value)
{
link *node = (link *)malloc(sizeof(link));
link *temp = head;
while(temp->next != head)
{
temp = temp->next;
}
temp->next = node;
node->data = value;
node->next = head;
}
//删除
void link_del(link *head,int value)
{
int ret = link_find(head,value);
if(ret == -1)
{
printf("不存在这个数\n");
return;
}
link *t