title: Dereferencing a reference in a function argument
body: <p>In the following website:</p>
  
  <p><a href="http://leetcode.com/2010/09/serializationdeserialization-of-binary.html" rel="nofollow">Link</a></p>
  
  <p>they discuss how to deserialize a binary tree. I can successfully implement the methods described but I am getting stuck on why the first parameter/argument to the function:</p>
  
  <pre><code>void readBinaryTree(BinaryTree *&amp;p, ifstream &amp;fin)
  </code></pre>
  
  <p>is written as <code>BinaryTree *&amp;p</code>. More specifically, I don't understand why we must dereference the reference to <code>p</code>. Any clarification would be greatly appreciated.   </p>
  
  <p>If one were to re-write the function, would it look like this instead?</p>
  
  <pre><code>void readBinaryTree(BinaryTree &amp;p, ifstream &amp;fin) {
    int token;
    bool isNumber;
    if (!readNextToken(token, fin, isNumber)) 
      return;
    if (isNumber) {
      p = new BinaryTree(token);
      readBinaryTree(p.left, fin);
      readBinaryTree(p.right, fin);
    }
  }
  </code></pre>
  
  <p>Is this correct?</p>