删除
bool LList_TailInsert(LList_t *Head,DataType_t data)
{
if (NULL == Head)
return false;
//对链表的头文件的地址进行备份
LList_t *Phead = Head;
LList_t *lhead = Head;
//首结点
while(Phead->next != NULL)
{
//把头的直接后继作为新的头结点
Phead = Phead->next;
lhead = Phead;
}
lhead->next = NULL;//找到尾节点的前驱,把尾节点给断开
free(Phead);
return true;
}
bool LList_DestInsert(LList_t *Head,DataType_t dest,DataType_t data)
{
if (NULL == Head)
return false;
//对链表的头文件的地址进行备份
LList_t *Phead = Head;
LList_t *lhead = Head;
Phead = Phead->next;
lhead = Phead;
while(Phead->next != NULL)
{
if (Phead->data == data)
{
lhead->next = Phead->next;
Phead->next = NULL;
free(Phead);
return true;
}
//把头的直接后继作为新的头结点
lhead = Phead;
Phead = Phead->next;
}
}
标签:Head,删除,lhead,next,LList,Phead,NULL
From: https://www.cnblogs.com/-110/p/18151610