ListNode* ReverseList(ListNode* pHead)
{
ListNode* newh = NULL;
for(ListNode* p = pHead; ;p=p->next )//p为工作指针
{
p -> next = newh;
newh = p;
}
return newh;
}
ListNode* ReverseList(ListNode* pHead)
{
ListNode* newh = NULL;
for(ListNode* p = pHead; ;p=p->next )//p为工作指针
{
p -> next = newh;
newh = p;
}
return newh;
}