Hey I have build an implementation of linked list in c++ using List class and inner node struct. everything works fine except removing node from tail function:
void List::remove_tail()
{
Node* runPtr= new Node;
runPtr = this->head;
while(runPtr->next->next !=nullptr) //this loop is not stopping!
{
runPtr = runPtr->next;
}
this->tail= runPtr;
delete runPtr;
}
for some reason the while loop is not stopping. what am I missing?
Thanks for the help!