/** * @funcion:將鏈表逆序 * @return :返回新鏈表的頭結點 */
Node *inverteSequence(Node *head){
Node *newHead=NULL;
Node *p=NULL;
while(head){
p=head;
head=head->next;
p->next=NULL;
if(newHead==NULL){
newHead=p;
}else{
p->next=newHead;
newHead=p;
}
}
return newHead;
}