倒序思路:依次把后面的节点移往头部。 struct Node{
struct Node* next;
int data;
}; typedef struct Node NODE; NODE* invert_link_list2(NODE* head)
{
if(head == ){
return ;
} NODE* xpre = head;
NODE* x = head->next; for(; xpre->next != ; x = xpre->next)
{
xpre->next = x->next;
x->next = head;
head = x;
} return head;
}