We did all this 2 weeks ago with insertNode, and you were either not returning a result, or just ignoring the result.
Oh well,
int findNode(NODE *node, int findData)
{
if(node == NULL)...
Type: Posts; User: Salem
We did all this 2 weeks ago with insertNode, and you were either not returning a result, or just ignoring the result.
Oh well,
int findNode(NODE *node, int findData)
{
if(node == NULL)...
Your recursive calls of findnode don't return anything.
Try this as your main
int main(void)
{
TREE *tree;
tree = createTree();
int i;
for ( i = 0 ; i < 10 ; i++ ) {
printf("Root was %p;", (void*)tree->root);
Did you try the modification?
Did it work?
> It would only be applicable for the first node - root, isn't it? Or am I wrong?
Yes, it only applies to the first assignment.
But then again, ...
So back to line 70, where is THAT result being stored?
Look at line 40
insertNode(tree->root, newNode, dataIn);
Look at line 43
NODE *insertNode(NODE *root, NODE *newNode, int dataIn)
Now back to line 40
...
> if(dataInPtr < root->dataPtr)
You need to store (and compare) values, NOT pointers.