struct node
{
int data;
node* next;
};
// 单向链表头,如何倒序操作
inverse(node* head)
{
node thead;
thead.next = NULL;
for(current = head; current!=null; )
{
if ( current == head )
{
node * t = current->next;
thead.next = current;
current->next = NULL;
current = t;
}
else
{
node * t = current->next;
node* t2 = thead.next;
thead.next = current;
current->next = t2;
current = t;
}
}
return thead.next;
}
{
int data;
node* next;
};
// 单向链表头,如何倒序操作
inverse(node* head)
{
node thead;
thead.next = NULL;
for(current = head; current!=null; )
{
if ( current == head )
{
node * t = current->next;
thead.next = current;
current->next = NULL;
current = t;
}
else
{
node * t = current->next;
node* t2 = thead.next;
thead.next = current;
current->next = t2;
current = t;
}
}
return thead.next;
}