//删除链表中数据位item的数据
//copyright @anduo
//date:2012.10.10
void PurgeItem(LinkList &list)
{
LinkList p, q =list;
p = list->next;
//judge the second node
while (p != NULL)
{
if (p->data == item)
{
q->next = p->next;
free(p);
p = q-next;
}
else
{
q = p;
p = p->next;
}
}
//judge if the first node is item
if (list->data == item)
{
q = list;
list = list->next;
free(q);
}
}
删除链表中的数据
最新推荐文章于 2022-11-19 22:14:33 发布