i have a Node and i want to add a new entry at the end
the first entry is added correctly on head but the next entry is not added at all
when i use head->next = New_Node; it adds the new entry but not if i use the current pointerCode:struct Node { FlightRec entry; Node *next; }; class List { public: void ReadFlight(); void AddFlight(FlightRec iInput); private: Node *head; }; void List::AddFlight(FlightRec iInput) { Node* New_Node = new Node; New_Node->entry = iInput; New_Node->next = NULL; if (head == NULL) { head = New_Node; head->next = NULL; } else { Node* previous = head, *current = head->next ; while(current != NULL) { previous = current; current = current->next; } current = New_Node; // head->next = New_Node; current->next = NULL; bool breakpoint = false; } }
any ideas why??
thanks![]()




Reply With Quote