You are viewing a single comment's thread. Return to all comments →
Add another condition to handle the End case:
if(temp->next == nullptr){ new_node->prev = temp; temp->next = new_node; break; }
Seems like cookies are disabled on this browser, please enable them to open this website
Inserting a Node Into a Sorted Doubly Linked List
You are viewing a single comment's thread. Return to all comments →
Add another condition to handle the End case:
if(temp->next == nullptr){ new_node->prev = temp; temp->next = new_node; break; }