[求助]链表逆向输出!
原链表:head->12->16->315->426->920->NULLstruct Addresslist *change(struct Addresslist *head)
{
struct Addresslist *p1;
struct Addresslist *p2;
p1=head;
head=head->next;
p1->next=NULL;
while(head!=NULL)
{
p2=head;
head=head->next;
p2->next=p1;
p1=p2;
}
if(head==NULL)
{
p2->next=p1;
head=p2;
}
return head;
}(这个函数是我自己编写的,一运行显示结果时就变成了死循环,请指教!或者帮忙编个也可以)