title: An error: expected constructor, destructor, or type conversion before '(' token
body: <p>I am getting an error in *insert_nodes function: </p>
  
  <blockquote>
    <p>error: expected constructor, destructor, or type conversion before '(' token</p>
  </blockquote>
  
  <p>I also have a problem in the same function, it sais that i have to redeclare the 'int nodes' as a parameter in the function. but i think it's not necessary to write it like this:</p>
  
  <pre><code>*insert_nodes(start, int nodes)
  </code></pre>
  
  <p>instead of being like this:</p>
  
  <pre><code>*insert_nodes(start,nodes)
  </code></pre>
  
  <p>Another error that a get is in getch(). While compiling in Netbeans, it just shows an error on that place but it doesn't mention what type of error.</p>
  
  <pre><code>struct tree_traversal
  {
      int data;
      tree_traversal *left; //left subtree
      tree_traversal *right; //right subtree
  };
  
  tree_traversal *insert_nodes(tree_traversal *start, int nodes);
  void preOrderTraversal(tree_traversal *start);
  void postOrderTraversal(tree_traversal *start);
  void inOrderTraversal(tree_traversal *start);
  int counter = 1;
  
  int main(int argc, char **argv)
  {
      int choice, nodes;
      do
      {
          switch(choice)
          {
               case 1:
               cout&lt;&lt;"\n\t\a\a Enter the Values:\a\a";
               cin&gt;&gt;nodes;
               start=insert_nodes(start,nodes);
               break;
  
               case 2:
               cout&lt;&lt;"\n\t\a\a The Values for In-Order Tree traversal is: \a\a"&lt;&lt;endl;
               preOrderTraversal(start);
               break;
  
               case 3:
               cout&lt;&lt;"\n\t\a\a The Values for In-Order Tree traversal is: a\a"&lt;&lt;endl;
               postOrderTraversal(start);
               break;
  
               case 4:
               cout&lt;&lt;"\n\t\a\a The Values for In-Order Tree traversal is: \a\a"&lt;&lt;endl;
               inOrderTraversal(start);
               break;
  
               case 5:
               exit(0);
          }
      } while(choice != 5);
      return 0;
  }
  
  tree_traversal *insert_nodes(tree_traversal *start, int nodes)
  {
      if(start == NULL)
      {
          start = new tree_traversal;
          start -&gt;left = start -&gt;right = NULL;
          start -&gt;data = nodes;
          counter++;
      }
      else if(counter%2 == 0)
          start -&gt;left = insert_nodes(start -&gt;left,nodes);
      else
          start -&gt;right = insert_nodes(start -&gt;right,nodes);
  
      return(start);
  }
  
  void preOrderTraversal(tree_traversal *start)
  {
      if(start != NULL)
      {
          cout&lt;&lt;start -&gt;data;
          preOrderTraversal(start-&gt;left);
          preOrderTraversal(start-&gt;right);
          getch();
      }
  }
  
  void postOrderTraversal(tree_traversal *start)
  {
      if(start != NULL)
      {
          postOrderTraversal(start-&gt;left);
          postOrderTraversal(start-&gt;right);
          cout&lt;&lt;start -&gt;data;
          getch();
      }
  }
  
  void inOrderTraversal(tree_traversal *start)
  {
      if(start != NULL)
      {
          inOrderTraversal(start-&gt;left);
          cout&lt;&lt;start -&gt;data;
          inOrderTraversal(start-&gt;right);
          getch();
      }
  }
  </code></pre>