void del(struct list *head)
{
struct list *pre,*p,*ppre;
ppre=head->next;
for(pre=head->next;pre->next->next!=NULL;pre=pre->next) /*pre 从第一个结点往后一指移动,知道倒数第二个结点,则停止*/
for(ppre=pre,p=pre->next;p!=NULL;ppre=ppre->next,p=p->next) /*ppre指向p所指向的结点的前驱结点,以做删除p结点之需*/
if(pre->num==p->num)
{
ppre->next=p->next;
p=ppre->next;
}
}
我给你改好了,想的我真蛋疼
首先说这个ppre->next 你就在循环中一直指下一个直接越界了
还有个基本知识 逗号表达式 最右边作为表达式的值
看看改的 一分也没有 太小气了0.0
{ int n; linklist L; printf(