Greetings To all!
To whomever, an advanced thank you if you help me. I am a Java programmer initially, but I have begun learning C++ and am doing something with a Double Linked List (Error occurs whether it's double or single, I teste it). Filling the contents of the list I have managed, but when I try and print each item of the list doing this, I get a run time error, which when I go to debugger looks like its trying to access a NULL
ListNode *p = head;
cout << "[ ";
for( ; p != NULL; p = p->next)
cout << p->data << " ";
cout << "]"
Now this code works fine in Java, but in C++ it makes a stink at me, a runtime stink. I shouldn't be overstepping the boundaries of the list, becuase the stopping condition in the for loop should catch before that happens, but I'm not sure what is going on. I'm stabbing at it being a NULL access that's not allowed, but I'm not sure that this is the error, becuase C++ is so fantastically wonderful at describing its errors of course(hopefully catching the sarcasm here)
Anywho, if some kind soul might shed some light on this stupid poor novice, I would appreciate becuase I'm sure it's something I missed that is probably trivial. (I tend to do that a lot). Thanks again!