title: reference to pointer not working on header files in C++
body: <p>When I use *&amp; reference in header files it gives me a error</p>
  
  <pre><code>void free_memory_circle( Node  *&amp; root );
  
  error: expected ‘;’, ‘,’ or ‘)’ before ‘&amp;’ token
  </code></pre>
  
  <p>I have a working liked list file with all the functions in a one file and when I try to separate them into .h and .cc files I cannot use *&amp; reference pointer. Would someone explain me the reason.</p>
  
  <p>my header file edited</p>
  
  <pre><code>#ifndef _EX4A_FREEMEMORY_H_
  #define _EX4A_FREEMEMORY_H_
  
  #include "BST.h"
  
  
  void free_memory_circle( Node  *&amp;root );
  void free_memory_rectangle( Node  *&amp;root );
  
  
  
  #endif  // FreeMemory.h
  </code></pre>
  
  <p>my code file </p>
  
  <pre><code>#include&lt;cstdlib&gt;
  #include "FreeMemory.h"
  #include "Circle.h"
  #include "Rectangle.h"
  
  void free_memory_circle( Node  *&amp;root )
  {
      if( root == NULL ) return;
      free_memory_circle( root-&gt;_left );
      free_memory_circle( root-&gt;_right );
      delete( (Circle * )root-&gt;data);
      delete ( root);
  
  }
  
  void free_memory_rectangle( Node  *&amp;root )
  {
      if( root == NULL ) return;
  
      free_memory_rectangle( root-&gt;_left );
      free_memory_rectangle( root-&gt;_right );
      delete( (Rectangle * )root-&gt;data);
      delete ( root);
  
  }
  </code></pre>
  
  <p>BST.h file</p>
  
  <pre><code>#ifndef _EX4A_BST_H_
  #define _EX4A_BST_H_
  #include "Circle.h" 
  #include "Rectangle.h"
  
  typedef struct Node
  {
      void *data;
      struct Node *_left, *_right;
  } Node ;
  
  extern double max_radius;   //saves maximum radius
  extern double max_area_rect;    //saves maximum area of rectangles
  extern Node *BST_circles ;
  extern Node *BST_rectangles ;
  
  //this is a similar to linked list(binary search tree)
  //so I have to use *&amp; here for head node
  //void add_circle_BST( Node *&amp; root , Circle *p );
  void add_circle_BST( Node * root , Circle *p );
  void PrintBST_circle_inorder( Node *root );
  void add_rectangle_BST( Node *root , Rectangle *p );
  void PrintBST_Rectangle_inorder( Node *root );
  void find_max_radius( Node *root);
  void find_max_area_rect( Node *root);
  
  #endif  // BST.h
  </code></pre>
  
  <p>BST.cc file</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include "BST.h"
  #include "Rectangle.h"
  #include "Circle.h"
  
  using namespace std;
  
  double max_radius = 0;  //saves maximum radius
  double max_area_rect = 0;   //saves maximum area of rectangles
  
  Node *BST_circles = NULL;
  Node *BST_rectangles = NULL;
  
  //this is a similar to linked list(binary search tree)
  //so I have to use *&amp; here for head node
  void add_circle_BST( Node *&amp;root , Circle *p )
  {
      //root = BST_circles;
      if( !root ) //IF root is null
      {
          root = new Node;
          root-&gt;data = p;
      }else{
              Circle *temp = (Circle *)root-&gt;data;
              if( temp-&gt;_x &gt; p-&gt;_x){  //if x value less than root x                
              add_circle_BST(root-&gt;_left , p); //add to left
      }else{
              add_circle_BST( root-&gt;_right , p);
      }
  }
  }
  
  void PrintBST_circle_inorder( Node *root )
  {
  if( root ){
      PrintBST_circle_inorder( root-&gt;_left);
      Circle *temp = (Circle *)root-&gt;data;
      cout &lt;&lt; temp-&gt;_x &lt;&lt; " " &lt;&lt; temp-&gt;_y &lt;&lt; " "
              &lt;&lt; temp-&gt;_r &lt;&lt; endl;
      PrintBST_circle_inorder( root-&gt;_right);
  
  }
  
  }
  
  
  void add_rectangle_BST( Node *root , Rectangle *p )
  {
  if( !root ){    //IF root is null
      root = new Node;
      root-&gt;data = p;
  }else { //
      Rectangle *temp = (Rectangle *)root-&gt;data;
      if( temp-&gt;_top_left_x &gt; p-&gt;_top_left_x)//if x value less than root x
      {
          add_rectangle_BST(root-&gt;_left , p); //add to left
      }
      else
      {
          add_rectangle_BST( root-&gt;_right , p);
      }
  }
  }
  
  
  void PrintBST_Rectangle_inorder( Node *root )
  {
  if( root )
  {
      PrintBST_Rectangle_inorder( root-&gt;_left);
      Rectangle *temp = (Rectangle *)root-&gt;data;
      cout &lt;&lt; temp-&gt;_top_left_x &lt;&lt; " " &lt;&lt; temp-&gt;_top_left_y &lt;&lt; " "
              &lt;&lt; temp-&gt;_bot_right_x &lt;&lt; " " &lt;&lt; temp-&gt;_bot_right_y &lt;&lt; endl;
      PrintBST_Rectangle_inorder( root-&gt;_right);
  
  }
  
  }
  
  
  
  void find_max_radius( Node *root)
  {
  if( root ){ //IF root is null
      Circle *temp = (Circle *)root-&gt;data;
      if( max_radius &lt; temp-&gt;_r )
      {
          max_radius = temp-&gt;_r;
      }
      find_max_radius(root-&gt;_left ); //add to left
      find_max_radius( root-&gt;_right);
  
  }
  }
  
  void find_max_area_rect( Node *root)
  {
  if( root ){ //IF root is null
      Rectangle *temp = (Rectangle *)root-&gt;data;
      if( max_area_rect &lt; Area_rect( temp ) )
      {
          max_area_rect = Area_rect( temp );
      }
      find_max_area_rect(root-&gt;_left ); //add to left
      find_max_area_rect( root-&gt;_right);
  
  }
  }
  </code></pre>
  
  <p>Circle.h</p>
  
  <pre><code>#ifndef _EX4A_CIRCLE_H_
  #define _EX4A_CIRCLE_H_
  
  
  typedef struct Circle{
      double _x,_y,_r;
  } Circle;
  
  #endif  // Circle.h
  </code></pre>
  
  <p>FreeMemory.h</p>
  
  <pre><code>#ifndef _EX4A_FREEMEMORY_H_
  #define _EX4A_FREEMEMORY_H_
  
  #include "BST.h"
  
  void free_memory_circle( Node  *&amp;root );
  void free_memory_rectangle( Node  *&amp;root );
  
  #endif  // FreeMemory.h
  </code></pre>