title: assignment from incompatible pointer type [enabled by default]
body: <p>Why am I getting this warnings in my <code>insertNode()</code>:</p>
  
  <pre><code>warning: assignment from incompatible pointer type [enabled by default]|
  </code></pre>
  
  <p>in this line:</p>
  
  <pre><code> head-&gt;next = newNode; //point head's next to the newNode
  </code></pre>
  
  <p>and </p>
  
  <pre><code>warning: initialization from incompatible pointer type [enabled by default]|
  </code></pre>
  
  <p>in this line:</p>
  
  <pre><code> Node *current = head-&gt;next; 
  </code></pre>
  
  <p>In my <code>main()</code> function I have also this warning:</p>
  
  <pre><code>warning: passing argument 1 of 'insertNode' from incompatible pointer type [enabled by default]|
  </code></pre>
  
  <p>in this line:</p>
  
  <pre><code>insertNode(&amp;head, num);
  </code></pre>
  
  <p>I have a bunch of others similar to these warnings in my code. How can I fix them? </p>
  
  <pre><code> typedef struct NodeStruct{
        int data;
        struct Node *next;
   }Node;
  
  void insertNode(Node *head, int data){
      Node *newNode = (Node *)malloc(sizeof(Node));
      newNode-&gt;data = data;
  
      if(head-&gt;next == NULL){
          head-&gt;next = newNode; 
          newNode-&gt;next = NULL;
      }
  
      else{
          Node *current = head-&gt;next; 
          while(current != NULL &amp;&amp; current-&gt;data &lt; data){
              current = current-&gt;next;
          }
          newNode-&gt;next = current-&gt;next;
          current-&gt;next = newNode; 
      }
  }
  
  int main(int argc, char *argv[])
  {
      Node *head = malloc(sizeof(NodeStruct));
      head-&gt;next = null;
      insert(head, 22);
      insert(head, 55);
      insert(head, 44);
      insert(head, 2);
      insert(head, 2112);
      insert(head, 3);
  
  
      printList(head);
      return 0;
  
  }
  </code></pre>