title: warning: control reaches end of non-void function [-Wreturn-type]
body: <p>I am having a slight is regarding functions. I believe it is likely because I am not using them. My code is as follows:</p>
  
  <pre><code>/*date difference calculator*/
  
  #include &lt;stdio.h&gt;
  
  int main()
  {
    int Date1 = 0, Date2 = 0, Dif, F, L, D1, D2, M1, M2, Y1, Y2;
    int x[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int y[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    char A1, A2, B1, B2;
  
  /*input first date*/
  
   fprintf (stderr , "Enter first date,in the form &lt;day&gt;/&lt;month&gt;/&lt;year&gt;  or &lt;day&gt;-&lt;month&gt;-&lt;year&gt;.\nWhere &lt;day&gt;,&lt;month&gt; and &lt;year&gt; are integers:\n");
   (scanf("%i%c%i%c%i", &amp;D1, &amp;A1, &amp;M1, &amp;B1, &amp;Y1));
  
  /*check first date*/
  
   if (!(Y1 % 4)) x[2]=29;
   while ((Y1 &lt; 1 || (Y1 &gt; 9999)) || (M1 &lt; 1 || M1 &gt; 12) || (D1 &lt; 1 || D1 &gt; x[M1]) || (A1 != B1) || ((A1 != '/') &amp;&amp; (A1 != '-'))) 
       {
         fprintf (stderr, "Incorrect format, re-enter date:\n");
         scanf("%i%c%i%c%i", &amp;D1, &amp;A1, &amp;M1, &amp;B1, &amp;Y1);
         if (!(Y1 % 4)) x[2]=29;
       }
  
  /*print first date*/
  
   fprintf (stderr, "First date = %i%c%i%c%i\n", D1 , A1 , M1 , B1 , Y1);
  
  /*input second date*/
  
   fprintf (stderr , "Enter second date,in the form &lt;day&gt;/&lt;month&gt;/&lt;year&gt; or &lt;day&gt;-&lt;month&gt;-&lt;year&gt;.\nWhere &lt;day&gt;,&lt;month&gt; and &lt;year&gt; are integers:\n");
   (scanf("%i%c%i%c%i", &amp;D2, &amp;A2, &amp;M2, &amp;B2, &amp;Y2));
  
  /*check second date*/
  
   if (!(Y2 % 4)) y[2]=29;
   while ((Y2 &lt; 1 || (Y2 &gt; 9999)) || (M2 &lt; 1 || M2 &gt; 12) || (D2 &lt; 1 || D2 &gt; y[M2]) || (A2 != B2) || ((A2 != '/') &amp;&amp; (A2 != '-'))) 
       {
         fprintf (stderr, "Incorrect format, re-enter date:\n");
         scanf("%i%c%i%c%i", &amp;D2, &amp;A2, &amp;M2, &amp;B2, &amp;Y2);
         if (!(Y2 % 4)) y[2]=29;
       }
  
  /*print second date*/
  
   fprintf (stderr, "Second date = %i%c%i%c%i\n", D2 , A2 , M2 , B2 , Y2);
  
  /*convert first date into days*/
  
   for (F = 1; Y1 &gt; F ; F++) 
      {
       if (F % 4 == 0) (Date1 = Date1 + 366);
       else (Date1 = Date1 + 365);
      }
   for (L = 1; M1 &gt; L ; L++) 
       Date1 = Date1 + x[L];
   Date1 = Date1 + D1;
  
  /*convert second date into days*/
  
   for (F = 1; Y2 &gt; F ; F++) 
      {
       if (F % 4 == 0) (Date2 = Date2 + 366);
       else (Date2 = Date2 + 365);
      }
   for (L = 1; M2 &gt; L ; L++) 
       Date2 = Date2 + y[L];
   Date2 = Date2 + D2;
  
  /*standard output*/
  
   Dif = Date2 - Date1;
   printf("\n%i\n\n" , Dif);
  
  /*text output*/
  
   if (Date2 &gt; Date1)  
      {Dif = Date2 - Date1;
      fprintf (stderr , "Indicating that the first date is %i days before second date.\n" , Dif);}
   if (Date1 &gt; Date2)  
      {Dif = Date1 - Date2;
      fprintf (stderr , "Indicating that the second date is %i days before first date.\n" , Dif);} 
   if (Date1 == Date2)  
      fprintf (stderr , "Indicating that the first date is equal to second date.\n"); 
  }
  </code></pre>
  
  <p>When compiling using this: <code>gcc -Wall -ansi date1.c -o date1</code>
  This occurs:</p>
  
  <pre><code>date1.c: In function ‘main’:
  date1.c:70:1: warning: control reaches end of non-void function [-Wreturn-type]
  </code></pre>
  
  <p>Is there a simple fix for this or do I have to write my program to use functions propely? I am unable to change how I compile the code as it has to follow a set spec.</p>
  
  <p>Apologies for the poor formatting of my question but this is my first time here and I was hoping to be able to do it alone.</p>
  
  <p>Hope someone can help!</p>