title: RecursiveFree Function - Warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
body: <p>I have a function which recursively frees:</p>
  
  <pre><code>#include "treeStructure.h"
  
  void destroyTree (Node* p)
  {
      if (p==NULL)
          return;
      Node* free_next = p -&gt; child; //getting the address of the following item before p is freed
      free (p); //freeing p
      destroyTree(free_next); //calling clone of the function to recursively free the next item
  }
  </code></pre>
  
  <p><strong>treeStructure.h:</strong></p>
  
  <pre><code>struct qnode {
    int level;
    double xy[2];
    struct qnode *child[4];
  };
  typedef struct qnode Node;
  </code></pre>
  
  <p>I keep getting the error</p>
  
  <blockquote>
    <p>Warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]</p>
  </blockquote>
  
  <p>and its pointing to 'p'.</p>
  
  <p>I don't understand why this is occurring.</p>
  
  <p>Can someone please explain and inform me how to fix this?</p>