链表逆序算法实现
TYPE *reverse(TYPE *head)
{
TYPE *pf=NULL,*pb=NULL,*pr=NULL;
pf = head;
pb=pf->next;
while(pb != NULL)
{
pr = pb->next;
pb->next = pf;
pf = pb;
pb = pr;
}
head->next = NULL;
head=pf;
return head;
}
链表清空算法实现
void Link_delete(TYPE *head)
{
TYPE *pb = NULL;
pb = head;
while(head != NULL)
{
head=head->next;
free(pb);
pb = head;
}
}