listsize prints out what i want it to, which is how big the actual list is, but the other 2 dont. printlist is supposed to print out the data, but it just prints out 0 and some other random crazy number and print all just prints 0.
all of this code worked fine in the main, but im trying to transition them to functions to make the main cleaner, i don't want to use a class either. help is greatly appreciated.
--
here is the working code for the non-function work.
And just what is your C++ related question?
You do know, I hope, that C++ provides a linked list container so you don't have to write your own. http://www.cplusplus.com/reference/stl/list/
Here are a few problems:
1) In the first listing, start1 is an uninitialized pointer.
In the second set of code, start1 is initialized at line 13.
2) In the function listsize, the pointer to the linknode is passed by value.
At line 13, you overlay whatever pointer value was passed.
3) In function listsize, t2 is allocated, and is never released. This will result in a memory leak each time listsize is called.