//接上一篇
//单链表的删除
node * del(node *head,int num)
{
node*p1,*p2;
p1 = head;
while(num!=p1->data && p1->data!= NULL)
{ p2 = p1; p1 = p1->next; }
if(num == p1->data) { if(p1 == head) { head = p1->next; free(p1); } else { p2->next = p1->next; free(p1); } else { printf("not found this number!"); } } return head;}
单链表的删除
最新推荐文章于 2024-06-07 15:34:45 发布