title: C++: Pointer vs Pointer of Pointer to insert a node in a Binary Tree
body: <p>I was creating a function to insert a element in a binary tree and, first, i did the following on Visual Studio 2012:</p>
  
  <pre><code>void Insert(Nodo *root, int x){
     if(root == NULL){
        Nodo *n = new Nodo();
        n-&gt;value = x
        root = n;
        return;
     }
     else{
        if(root-&gt;value &gt; x)
           Insert(&amp;(root)-&gt;left, x);
        else
           Insert(&amp;(root)-&gt;right, x);
     }
  }
  </code></pre>
  
  <p>But this same code doesn't work at Dev-C++, I need to use Pointer of Pointer to make it work, like this:</p>
  
  <pre><code>void Insert(Nodo **root, int x){
     if(*root == NULL){
        Nodo *n = new Nodo();
        n-&gt;value = x
        *root = n;
        return;
     }
     else{
        if((*root)-&gt;value &gt; x)
           Insert(&amp;(*root)-&gt;left, x);
        else
           Insert(&amp;(*root)-&gt;right, x);
     }
  }
  </code></pre>
  
  <p>Does anybody knows why it happens?</p>