结构体!链表,高手COME ON
程序代码:struct student *del(struct student *head,long num)
{
struct student *p1,*p2;
if(head==NULL){printf("nlist null!\n");return head;}
p1=head;
while(num!=p1->num&&p1->next!=NULL)
{p2=p1;p1=p1->next;}
if(num==pi->num)
{if(p1==head)head=p1->next;
else p2->next=p1->next;
printf("delete:%ld\n",num);
n=n-1;}
else printf("%ld not been found!\n",num);
return(head);
}这是个删除操作的函数!(书上写的)里面while循环是怎么回事啊,循环了一遍什么也没干呀while(num!=p1->num&&p1->next!=NULL)
{p2=p1;p1=p1->next;}
这不是一直到p1->next=NULL才结束循环,有什么用啊,大侠教教我!
高手再给我讲讲这个函数到底是怎么回事!书上写的不够详细额!









