title: Passing argument from incompatible pointer type warning
body: <p>I've been trying to figure out pointers in C most of today, even asked a <a href="https://stackoverflow.com/questions/2159498/need-some-help-understanding-pointers-and-memory-in-c">question</a> earlier, but now I'm stuck on something else. I've got the following code:</p>
  
  <pre><code>typedef struct listnode *Node;
  typedef struct listnode {
      void *data;
      Node next;
      Node previous;
  } Listnode;
  
  typedef struct listhead *LIST;
  typedef struct listhead {
      int size; 
      Node first;
      Node last; 
      Node current; 
  } Listhead;
  
  #define MAXLISTS 50
  
  static Listhead headpool[MAXLISTS];
  static Listhead *headpoolp = headpool;
  
  #define MAXNODES 1000 
  
  static Listnode nodepool[MAXNODES];
  static Listnode *nodepoolp = nodepool;
  
  LIST *ListCreate()
  {
      if(headpool + MAXLISTS - headpoolp &gt;= 1)
      {
          headpoolp-&gt;size = 0;
          headpoolp-&gt;first = NULL;
          headpoolp-&gt;last = NULL;
          headpoolp-&gt;current = NULL;
          headpoolp++;
          return &amp;headpoolp-1; /* reference to old pointer */
  
      }else
          return NULL;
  }
  
  int ListCount(LIST list)
  {
      return list-&gt;size;
  
  }
  </code></pre>
  
  <p>Now in a new file I have:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "the above file"
  
  main()
  {
      /* Make a new LIST */
      LIST *newlist; 
      newlist = ListCreate();
      int i = ListCount(newlist);
      printf("%d\n", i);
  }
  </code></pre>
  
  <p>When I compile, I get the following warning (the <code>printf</code> statement prints what it should):</p>
  
  <pre><code>file.c:9: warning: passing argument 1 of ‘ListCount’ from incompatible pointer type
  </code></pre>
  
  <p>Should I be worried about this warning? The code seems to do what I want it to, but I'm obviously very confused about pointers in C. After browsing questions on this site, I found that if I make the argument to ListCount <code>(void *) newlist</code>, I don't get the warning, and I don't understand why, nor what <code>(void *)</code> really does...</p>
  
  <p>Any help would be appreciated, thanks.</p>