面试里面的另外一个特别容易出的题目 反转链表
void reverselist(node** head){ if(*head == NULL) return ; node* pre = NULL; node* cur = *head; node* next = *head; while(cur){ next = cur->next; cur -> next = pre; pre = cur; cur = next; } *head = pre; }
原文:http://blog.csdn.net/shcalm/article/details/19821095