title: Expected primary-expression before ‘*’ token
body: <p>I have written a code to find max element in a binary search tree, I am getting the following error in Insert function:</p>
  
  <blockquote>
    <p>main.cpp: In function ‘bstNode* Insert(bstNode*, int)’:</p>
    
    <p>main.cpp:23:31: error: expected primary-expression before ‘*’ token</p>
    
    <p>root->left= Insert(bstNode* left,data);</p>
    
    <p>^</p>
    
    <p>main.cpp:25:32: error: expected primary-expression before ‘*’ token</p>
    
    <p>root->right= Insert(bstNode* right,data);</p>
    
    <p>^</p>
  </blockquote>
  
  <p>Following is the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  struct bstNode{
    int data;
    bstNode* left;
    bstNode* right;
  };
  
  bstNode* GetNewNode(int data){
    bstNode* newNode=new bstNode();
    newNode-&gt;data=data;
    newNode-&gt;right=newNode-&gt;left=NULL;
    return newNode;
  }
  
  bstNode* Insert(bstNode* root,int data){
    if(root==NULL)
      root=GetNewNode(data);
    else if(data &lt;= root-&gt;data)
      root-&gt;left= Insert(bstNode* left,data);
    else
      root-&gt;right= Insert(bstNode* right,data);
    return root;
  }
  
  void FindMax(bstNode* root){
    if(root-&gt;right==NULL)
      cout&lt;&lt;root-&gt;data;
    else
      FindMax(root-&gt;right);
  }
  
  
  int main()
  {
    bstNode* root=NULL;
    int T;
    cin&gt;&gt;T;
    int i,data;
    for(i=0;i&lt;T;i++){
      cin&gt;&gt;data;
      root=Insert(root,data);
    }
    FindMax(root);
  
      return 0;
  }
  </code></pre>
  
  <p>Please tell me what is the error and how can I rectify it.</p>