title: Same program gives compiler error in one compiler and not the other
body: <p>I'm studying Learn to Code with C by Simon Long.
  <a href="https://www.raspberrypi.org/magpi-issues/Essentials_C_v1.pdf" rel="nofollow noreferrer">https://www.raspberrypi.org/magpi-issues/Essentials_C_v1.pdf</a> 
  on page 20 there is this simple program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void main (void)
   {
    int a = 0;
    while (a &lt; 5)
  {
    printf ("a is equal to %d\n", a);
    a++;
  }
    printf ("a is equal to %d and I've finished\n", a);
  }
  </code></pre>
  
  <p>But when I compile this I get this compiler error:</p>
  
  <pre><code>while-loop.c:3:1: warning: return type of 'main' is not 'int'
    [-Wmain-return-type]
  void main(void)
  ^
  while-loop.c:3:1: note: change return type to 'int'
  void main(void)
  ^~~~
  int
  1 warning generated.
  </code></pre>
  
  <p>Why is this? It seems that the author's compiler does not give error for this. Why the discrepancy?</p>
  
  <p>When I change </p>
  
  <pre><code>void main (void) 
  </code></pre>
  
  <p>to</p>
  
  <pre><code>int main (void)
  </code></pre>
  
  <p>it compiles fine.</p>