struct student * del(struct student *head ,int i)
{
struct student *p1,*p2,*p3;
p1=head;
if(head==NULL) //链表为空时
printf("\nlist null\n");
else
for(p3=head;p3->next!=NULL;p3=p3->next)
{ if(p1!=head) //判断
p1=p3;
while(p1->num!=i&&p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(p1->num==i)
{
if(p1==head)
{
head=p1->next;
p3=head;}
else
{
p2->next=p1->next;
p3=p2;
printf("delete:%d\n",i);
}
}
else
{
printf("\n%dno fond i in the link\n");
break;
}
}
return(head);
}
{
struct student *p1,*p2,*p3;
p1=head;
if(head==NULL) //链表为空时
printf("\nlist null\n");
else
for(p3=head;p3->next!=NULL;p3=p3->next)
{ if(p1!=head) //判断
p1=p3;
while(p1->num!=i&&p1->next!=NULL)
{
p2=p1;
p1=p1->next;
}
if(p1->num==i)
{
if(p1==head)
{
head=p1->next;
p3=head;}
else
{
p2->next=p1->next;
p3=p2;
printf("delete:%d\n",i);
}
}
else
{
printf("\n%dno fond i in the link\n");
break;
}
}
return(head);
}