Here is my code:
template<class T>
void list<T>::addEnd(T input) {
node<T> *tempNode = new node<T>;
node<T> * current = head;
while (current->next == nullptr) {
current = current->next;
}
tempNode->data = input;
current->next = tempNode;
tempNode->next = nullptr;
tempNode->prev = current;
tail = tempNode;
}
The error occurs at the while(current->next == nullptr) line. I'm trying to implement a doubly linked list.
Aucun commentaire:
Enregistrer un commentaire