Mine
public cpp v1 · immutable void reverse() { // Trivial base case: empty list. if (head == NULL) return; LNode *current = head; LNode *prev = NULL; while (current != NULL) { // Remember which node is next before we clobber the link. LNode *next = current->next; // Reverse the link. current->next = prev; // Shift prev-current-next window. prev = current; current = next; } // At the end, prev is actually the last node because of // "prev = current" above. head = prev; }