逆置链表,不懂?
链表 带头结点:struct stu *turnback(struct stu *head)
{
struct stu *a,*newhead,*temp;
p2=head;
p1=head->next;
head->next=NULL;
while(p1!=NULL) //这里是如何逆置的?例如我输入四个数1,2,3,4,如何逆置成4,3,2,1?
{
temp=p1->next;
p1->next=p2;
p2=p1;
p1=temp;
}
newhead=p2;
return(newhead);
}