title: return value type does not match function type c programming linked list
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #define maxchar 50
  
  int numcars; 
  int c;//counter
  char fu[5];//debug
  int main()
  {
      typedef struct car //info of car
      {
          int year;
          char vin[maxchar];
          char make[maxchar];
          char model[maxchar];
          car *next;
      };
  
      car *first;
      car *newcar;
  
  
      printf("Enter the Number of Cars you have: ");
      scanf("%i", &amp;numcars);
  
      struct car *addtolist(struct car *first);
      {
          newcar = (car*)malloc(sizeof(car));
  
          printf("\nEnter The Model Year: ");
          scanf("%i", &amp;newcar-&gt;year);
          printf(" ");//for some reason the program always skips the first 'gets' so this one is here to take that hit.
          gets(fu);
          printf("\nEnter The Make: ");
          gets(newcar-&gt;make);
          printf("\nEnter The Model: ");
          gets(newcar-&gt;model);
          printf("\nEnter The Vehicle Identifaction Number: ");
          gets(newcar-&gt;vin);
  
          newcar-&gt;next = first;
          first = newcar;
          return newcar;
      }
  
  
  }
  </code></pre>
  
  <p>I am a student learning linked lists and this is a homework project.</p>
  
  <p>The function '<strong>struct car *addtolist(struct car *first)</strong>' was originally not a function but was simply enclosed in a <strong>for loop</strong>, looping '<strong>numcar</strong>' times,  while I was getting it to work properly, which I did.</p>
  
  <p>For the next step I simply wanted to add the function bits, the <strong>declaration</strong> and <strong>return</strong>, and then enclose the call for the function in a <strong>for loop</strong>.</p>
  
  <p>My problem is that the compiler keeps telling me that the <em>return type does not match the function type</em>.</p>
  
  <p>What did I do wrong?</p>