标签:
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode* reverseList(struct ListNode* head) { if(head==NULL) return NULL; struct ListNode*prev=NULL; while(head!=NULL) { struct ListNode *temp; temp = head->next; head->next = prev; prev = head; head = temp; } return prev; }
标签:
原文地址:http://www.cnblogs.com/pencilCool/p/4676189.html