Lines 43 and 44 don't make sense:
if(root == NULL)
root[i][j] = new node(a);
This would make more sense:
if(root != NULL)
root[i][j] = new node(a);
The whole point of checking for NULL is so that you don't dereference a NULL pointer. You're checking to make SURE it's a NULL pointer, THEN dereferencing it. You don't want to do that.Create the node.
Check to make sure the node is not null.
Use the node.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
Thanks for the post!
You're welcome.You made me realize what was wrong with my code although your response wasn't what I was looking for.
What are you looking for?
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711