Ok so I know how to do this with pointer to pointer..
AddNode(Node **ppNode) and what not but I cant figure out for the life of me how to get it working with just a single pointer.
The code is small but a mess and I have no clue how to get this working so the arguments are just AddNode( Node *pNode ) etc.
Thanks to anyone who can fix where I'm going wrong :)
I tried using you code and just changing node pointer to a node pointer reference for addNode, and it got stuck in a loop printing a number. But then I just decided to clean up whenever you dereferenced and then referenced something, and it worked for some reason.
Thanks a heap for that. It works a charm. But whats the main point in pointer to reference. As In "Node *&pNode" is this basically just allowing the pointer to be edited?
then it simply sends the pointer by reference that is you can modify the pointer to point anywhere you want to (of course not beyond the memory you have been given for your program else it may lead to a segmentation fault) whereas Node *pNodewill simply create a copy of the pointer and pass the copy so the original pointer cannot be modified