This inOrder appears to be decreasing. If you pass in 5 for value, and the first number in the list is 2, then 5 < 2 will be false, and we won't walk the list. Is it supposed to be increasing? (If so, then that < would need to become a >.)
This inOrder appears to be decreasing. If you pass in 5 for value, and the first number in the list is 2, then 5 < 2 will be false, and we won't walk the list. Is it supposed to be increasing? (If so, then that < would need to become a >.)
Ohhh yeah good eye. I guess so, but like I said, I can't change it. I guess I'll just flip my data around and treat it as decreasing. Now just one more question...how do I implement the functions that have LListNode<Data>* as parameters?
I just don't know what to put there as a parameter. Is it just LListNode<int> node? Because it's complaining at me again :/
You would need to pass a pointer to the node.
Sorry I have no idea how to do that.
Just like you would pass a pointer to anything else: with &.
Remember I can't edit the header file. I'm not sure how to pass a pointer to a node when all I have to work with is my main function. I used the addToEnd function to create my list and therefore really don't even use nodes myself. I don't know how to do this part.
What does editing the header file have to do with anything? Every variable has an address, that you can get by prefix the variable name with &. So if a function needs the address of a variable, you should give it the address of the variable.
Note also, as you can see in the addToEnd function, that the new keyword gives you a pointer to a <whatever you created>.
I'm sorry I have had the worst time with pointers and passing parameters. I am great at everything else but I can't seem to get this point. It is so frustrating because I know it's the simplest thing in the world but I just can't get it. It really makes me so mad knowing that this is simple and I can't understand!!
Edit::sorry it was just that simple. I just needed to create a node via LListNode<int>* node; and use that...I'm embarassed.
Last edited by Todd88; 11-27-2008 at 12:30 AM.