【注意】只需要完成该函数功能算法,中间不需要有任何IO 的输入输出
// 返回新链表头节点 LinkNode *reverse_link(LinkNode *head) { if(head == NULL) return NULL; LinkNode *prev , *curr , *reverse_head , *temp; prev = NULL , curr = head; while(curr->next) { temp = curr->next; curr->next = prev; prev = curr; curr = temp; } curr->next = prev; reverse_head = curr; return reverse_head; }
原文地址:http://blog.csdn.net/wtyvhreal/article/details/42474941