Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void addToList(int dataToAdd){
- Node nodeToBeAdded(dataToAdd, NULL); //initilize the node we are going to add with the data that was given by the user
- if(this->getHead() == NULL){
- this->setHead(&nodeToBeAdded);
- cout << "Added " << this->getHead()->getData() << " to the head of the listn";
- return;
- }
- //Calls this even after I set the heads next
- else if(this->getHead()->getNext() == NULL){
- cout<<"Testn";
- this->getHead()->setNext(&nodeToBeAdded);
- }
- //IT NEVER REACHES THIS
- else{
- cout<<"super testn";
- }
- }
- Added 3 to the head of the list
- Test
- Test
Add Comment
Please, Sign In to add comment