title: Incompatible types struct* and struct,
body: <p>Thanks for taking the time to read my question,
  I've looked at a few similar questions and they don't seem to help in this instance
  although may help others with similar troubles:</p>
  
  <p><a href="https://stackoverflow.com/questions/5164496/c-incompatible-types">C: Incompatible types?</a><br>
     <a href="https://stackoverflow.com/questions/25203047/struct-as-incompatible-pointer-type-in-c">Struct as incompatible pointer type in C</a><br>
     <a href="https://stackoverflow.com/questions/15869755/incompatible-types-error-with-struct-c">Incompatible Types Error with Struct C</a></p>
  
  <p>I'm attempting to create a simple linked list structure in c (-std=c99),
  my structure is fairly generic at this point:</p>
  
  <pre><code>typedef struct
  {
    int count;
    char* word;
    struct node *nextNode;
  }node;
  </code></pre>
  
  <p>then in a function i have a "root" or "head" node:</p>
  
  <pre><code>node *root;
  root = (node *) malloc(sizeof(node));
  </code></pre>
  
  <p>and i attempt to assign a <code>node</code> to the root nodes <code>nextNode</code> later on in the function like so:</p>
  
  <pre><code>if(root-&gt;nextNode == 0)
  {
    root-&gt;nextNode = foo;
  }
  </code></pre>
  
  <p>Which leads to an error:<br>
      "error incompatibles types when assigning to type <code>struct node*</code> from type <code>node</code><br>
      <code>&amp;foo</code> does not improve the situation, instead resulting in a <code>lvalue required as unary</code> style error.</p>
  
  <p>Here is the context surrounding my issue:</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      #include &lt;malloc.h&gt;
      #include &lt;string.h&gt;
  
      typedef struct
      {
          int count;
          char* word;
          struct node *nextNode;
      }node;
  
      node makenode(char *word)
      {
          node x;
          x.word = word;
          x.count = 1;
          return x;
      }
  
      void processInput(int threshold, const char* filename)
      {   
          node *root;
          root = (node *) malloc(sizeof(node)); 
          root-&gt;nextNode = 0;  
          char* word;
          while(fgets(word, 29, stdin) != NULL){
              if(root-&gt;nextNode == 0)
              {
                  root-&gt;nextNode = makenode(word);
              }
  </code></pre>