title: incompatible types when assigning to type ‘struct ZipperNode’ from type ‘ZipperTree’
body: <p>So, I'm getting this gcc compilation error when compiling:</p>
  
  <blockquote>
    <p>zipper.c: In function ‘fillZipperInfo’:
    zipper.c:384:22: error: incompatible types when assigning to type ‘struct ZipperNode’ from type ‘ZipperTree’
        forest[current++] = n;</p>
  </blockquote>
  
  <p>Here's the opaque type definition on the "zipper.h" file:</p>
  
  <pre><code>typedef struct ZipperNode *ZipperTree;
  </code></pre>
  
  <p>And here the ZipperNode definition on the "zipper.c" file:</p>
  
  <pre><code>struct ZipperNode {
      int count;
      ZipperTree left;
      ZipperTree right;
      Symbol symbol;
  };
  </code></pre>
  
  <p>And the surrounding section where the error is being called:</p>
  
  <pre><code>ZipperTree forest = malloc(sizeof(ZipperTree) * ft-&gt;total);
  int current = 0;
  int i;
  for(i = 0; i &lt; ft-&gt;size; i++) {
      if(ft-&gt;symbols[i] &gt; 0) {
          ZipperTree n = malloc(sizeof(ZipperTree));
          n-&gt;count = ft-&gt;symbols[i];
          n-&gt;symbol = i;
          forest[current++] = n; //here!!
      }
  }
  </code></pre>
  
  <p>And here's the ft type, FreqTable, just in case, which is also pre-defined on "zipper.h":</p>
  
  <pre><code>struct FreqTable {
      int symLength;
      size_t size;
      Symbol* symbols;
      int total;
  };
  </code></pre>
  
  <p>And I think this might be all I need to make the following question: what might be causing the error at the start of the post?</p>
  
  <p>Thanks for your answers.</p>