The program crashes atCode:(*temp).next = NULL;Just for future referance, is it helpful if I leave in all the cout statment I use for debuging?Code:#include <cstdlib> #include <iostream> //#include <cstring> #include <string.h> #include "..\include\LinkedList.h" LinkedList::LinkedList() : length(0), startPointer(NULL) { } LinkedList::~LinkedList() { } bool LinkedList::createNode(char name[]) { if(startPointer == NULL) { startPointer = new Node; strcpy((*startPointer).name, name);//can't just assign with = because can't do arr1[]=arr2[] std::cout << "Your name is: " << (*startPointer).name << std::endl; } else { Node *temp = startPointer; while((*temp).next != NULL) { temp = (*temp).next; /*This isn't working*/ (*temp).next = NULL; } (*temp).next = new Node; strcpy((*temp).name, name); std::cout << "Your last name is: " << (*startPointer).name <<std::endl; } return true; }



LinkBack URL
About LinkBacks



