title: Why am I getting an initialization from incompatible pointer type warning?
body: <p>So I'm using gcc on Linux and have the following two code snippets in separate files (only relaveant sections of code included):</p>
  
  <pre><code>int main()
  {
      /* Code removed */
      int_pair_list *decomp = prime_decomp(N);
      if (decomp)
          while(decomp-&gt;next)
              decomp = decomp-&gt;next;
      printf("%d\n" decomp-&gt;value_0);
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>int_pair_list *prime_decomp(unsigned int n)
  {
      int_pair_list *head = malloc(sizeof(*head));
      int_pair_list *current;
      /* method body removed, current and head remain as int_pair_list pointers */
      return current ? head : NULL;
  }
  </code></pre>
  
  <p>The program compiles and runs correctly but, during compilation, I get the warning:</p>
  
  <pre><code>problem_003.c: In function ‘main’:
  problem_003.c:7:26: warning: initialization from incompatible pointer type [enabled by default]
    int_pair_list *decomp = prime_decomp(N);
                        ^
  </code></pre>
  
  <p>I'm new to C and I just can't work out why I'm getting this warning.</p>