title: Linked list and pointer to incomplete class type
body: <p>I'm trying to compare a letter to data part in order to insert it in alphabetical order in linked list, What is wrong with this?</p>
  
  <pre><code>typedef struct{
      char data;
      struct list_node *next;
  }list_node;
  
  typedef struct{
      list_node *head;
  }list;
  </code></pre>
  
  <p>I'm trying to do the following:</p>
  
  <pre><code>void input_char(list *my_list, char x)
  {
      list_node *node = (list_node*)calloc(1, sizeof(list_node));
      list_node *tmp = my_list-&gt;head;
      node-&gt;data = x;
  
      if (tmp == NULL)
          my_list-&gt;head = tmp;
      else if (tmp-&gt;next == NULL)
      {
          if (x &lt; tmp-&gt;data)
          {
              node-&gt;next = tmp;
              my_list-&gt;head = node;
          }
          else
              tmp-&gt;next = node;
  
          tmp = tmp-&gt;next;
      }
      else
      {
          if (x &lt; tmp-&gt;next-&gt;data) 
    // This following line says "Error, Pointer to incomplete type is not allowed.
          {
              node-&gt;next = tmp-&gt;next;
              tmp-&gt;next = node;
          }
          tmp = tmp-&gt;next;
      }
  }
  </code></pre>