I wonder why the following code work. In the debugger i see that every thing works fine but after the "root = createNode(item);" statement I can't see the new node assigned to root?
Node *insert( Node *root, int item )
{
if(root==NULL)
root = createNode(item);
if(root->data>item)
insert(root->left,item);
else if(root->data<item)
insert(root->right,item);
return root;
}