title: Declaring a new node but doesn't equals NULL
body: <pre><code>class node
  {
  public:
      int data;
      node *left;
      node *right;
  };
  
  void insert(node * root, node * newnode)
  {
  if (root != NULL)
  {
      cout&lt;&lt;"Here1"&lt;&lt;endl;
      if (root-&gt;data &gt; newnode-&gt;data)
          if (root-&gt;left != NULL)
              insert(root-&gt;left,newnode);
          else
              root-&gt;left = newnode;
      else
          if (root-&gt;right != NULL)
              insert(root-&gt;right,newnode);
          else
              root-&gt;right = newnode;
      return;
  }
  else
      root = newnode;
  }
  
  void inorder(node * root)
  {
  if (root != NULL)
  {
      inorder(root-&gt;left);
      cout&lt;&lt;root-&gt;data&lt;&lt;endl;
      inorder(root-&gt;right);
  }
  }
  
  node * newn(int ele)
  {
      node *newnode = new node();
      newnode-&gt;left = NULL;
      newnode-&gt;right = NULL;
      newnode-&gt;data = ele;
      return newnode;
  }
  
  int main(void)
  {
  int ele,choice = 0;
  node *root = new node();
  while(choice != 5)
  {
      cout&lt;&lt;"1. Enter\n"
             "2. Inorder\n"
             "3. PreOrder\n"
             "4. PostOrder\n"
             "5. Exit\n";
      cin&gt;&gt;choice;    
      switch(choice)
      {
          case 1: cout&lt;&lt;"\nElement : ";
                  cin&gt;&gt;ele;
                  insert(root,newn(ele));
                  break;
          ....
  </code></pre>
  
  <p>This is a code for binary search tree in c++. Its only the insertion part. And the inorder printing function.</p>
  
  <p>When I create 3 nodes, and then try to print inorder, it shows initially a zero. And for testing this I tried to print "here", and it seems when I declare a root node pointer and it is not equal to NULL. I don't seem to understand this.</p>