1 mylist *listReverse(mylist *head) 2 { 3 mylist *p=head; 4 mylist *pfront=NULL,*pNext; 5 while(p!=NULL) 6 { 7 pNext=p->next; 8 p->next=pfront; 9 pfront=p; 10 p=pNext; 11 } 12 return pfront; 13 }
时间: 2024-10-23 18:13:44
1 mylist *listReverse(mylist *head) 2 { 3 mylist *p=head; 4 mylist *pfront=NULL,*pNext; 5 while(p!=NULL) 6 { 7 pNext=p->next; 8 p->next=pfront; 9 pfront=p; 10 p=pNext; 11 } 12 return pfront; 13 }