title: Returning a linked list struct from C function
body: <p>I've created the following linked list struct:</p>
  
  <pre><code> struct node {
      struct data *data;
      struct node *next;
   };
  </code></pre>
  
  <p>My problem is that when I'm trying to create a function that returns this linked list struct, I'm getting the following error message:</p>
  
  <pre><code>"Conflicting types for 'function'".
  </code></pre>
  
  <p>My function looks like this :</p>
  
  <pre><code>struct list_node *function(location piece){
      struct list_node *details;
      details = malloc( sizeof(struct list_node) );
      details-&gt;next = NULL;
      details-&gt;current = NULL;
      if (global_var == WHITE_M){
              struct list_node *temp;
              temp = malloc( sizeof(struct list_node) );
              data new_data;
              *temp-&gt;data = new_data;
              temp-&gt;next = malloc( sizeof(struct list_node) );
              temp-&gt;next = details;
              details = temp;
          }
   return details;
  }
  </code></pre>
  
  <p>Actually what I'm trying to do in my function is creating new linked list, then connecting new nodes to it, and return the linked list.</p>
  
  <p>Every return phrase I've tried, and evert declaration I've tried brought me to the same error, can someone please help me ?</p>