title: How do I get rid of this initialization from incompatible pointer type warning/error?
body: <p>I am trying to write a linked list program in C, however I keep on getting an initalization from incompatible pointer type warning/error.  How do I get rid of this?  And could you explain what is wrong?  What follows is a simplified version of my program:</p>
  
  <pre><code>typedef struct node
  {
  int contents;
  struct Node *nextNode;
  } Node;
  
  int main(void)
  {
  //.......Other code here......
    Node *rootNode = (Node *) malloc(sizeof(Node));
    rootNode-&gt;nextNode = NULL;
  //.......Other code here......
    addNode(rootNode);
  }      
  
  addNode(Node *currentNode)
  {
  //.....Other code here....
    Node *nextNode = (currentNode-&gt;nextNode);   //Error on this line
  // ....Other code here...
  }
  </code></pre>
  
  <p>Thanks</p>