title: The return type of main() function
body: <p>I get this code:</p>
  
  <pre><code>#include&lt;stdio.h&gt; 
  #include&lt;stdlib.h&gt;
  
  void main(void) 
  { 
      char *ptr = (char*)malloc(10); 
  
      if(NULL == ptr) 
      { 
          printf("\n Malloc failed \n"); 
          return; 
      } 
      else 
      { 
          // Do some processing 
          free(ptr); 
      } 
  
      return; 
  } 
  </code></pre>
  
  <p>It compiles successfully in Visual C, but do not compile in gcc, I get "error:'main' must return 'int'". So is the return type 'int' of main() function is a convention(which is for compiler to define), or a rule of C?</p>