# 线性表的链表的增删查改等的操作

``````
#include<stdio.h>
//d定义类型
typedef int LDateType;
//定义结构体类型
typedef struct listNode
{
LDateType _date;
struct listNode* _next;
}listNode;
//定义头指针
typedef struct list
{
}list;
//初始化头指针
void InistList(list* lst)
{
if (lst == NULL)
return;
//初始化为空的链表
}
listNode* creatNode(LDateType val)
{
listNode* node = (listNode*)malloc(sizeof(listNode));
node->_date = val;
node->_next = NULL;
return node;
}
//尾插
void listPushBack(list* lst, LDateType val)
{
if (lst == NULL)
return;
//空链表插入
{
}
//非空链表尾插
else
{
while (tail->_next != NULL)
{
tail = tail->_next;
}
tail->_next = creatNode(val);
}

}
//尾删
void listPopBack(list* lst)
{
struct listNode* prev = NULL;
while (tail->_next != NULL)
{
prev = tail->_next;
tail = tail->_next;
}
//删除节点
free(tail);
//修改指向
if (prev == NULL)//删除的为头结点，更新头结点
else
prev->_next = NULL;
}
//头插
void listPushFront(list* lst, LDateType val)
{
if (lst == NULL)return;
//空的链表，插入第一个数据
else
{
listNode* node = creatNode(val);
node->_next = next;
}
}
//头删
void listPopFront(list *lst)
{
if (lst == NULL || lst->_head == NULL)return;
//释放头结点
}
//第一个元素后后插入
void listInsertAfter(listNode* cur, LDateType val)
{
listNode* node = creatNode(val);
listNode* next = cur->_next;
cur->_next = node;
node->_next = next;
}
//删除第二个元素
void listEraseAfter(listNode* cur)
{
listNode* next = cur->_next;
if (next == NULL)return;
listNode* nextnext = next->_next;
free(next);
cur->_next=nextnext;
}
//查找值为val，返回地址
listNode* listFind(list* lst,LDateType val)
{
if (lst == NULL || lst->_head == NULL)return;
//从第一个值开始遍历
while (cur)
{
if (cur->_date == val)
return cur;
cur = cur->_next;
}
return NULL;
}
//求链表的大小
int listSize(list* lst)
{
if (lst == NULL)return;
int count = 0;
while (next)
{
next = next->_next;
count++;
}
return count;
}
//销毁链表
void listDestroy(list* lst)
{