title: What should main() return in C and C++?
body: <p>What is the correct (most efficient) way to define the <code>main()</code> function in C and C++ — <code>int main()</code> or <code>void main()</code> — and why? And how about the arguments?
  If <code>int main()</code> then <code>return 1</code> or <code>return 0</code>?</p>
  <hr>
  <p><em>There are numerous duplicates of this question, including:</em></p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/2108192/what-are-the-valid-signatures-for-cs-main-function/">What are the valid signatures for C's <code>main()</code> function?</a></li>
  <li><a href="https://stackoverflow.com/questions/17715008/the-return-type-of-main-function/">The return type of <code>main()</code> function</a></li>
  <li><a href="https://stackoverflow.com/questions/636829/difference-between-void-main-and-int-main">Difference between <code>void main()</code> and <code>int main()</code>?</a></li>
  <li><a href="https://stackoverflow.com/questions/1621574/mains-signature-in-c"><code>main()</code>'s signature in C++</a></li>
  <li><a href="https://stackoverflow.com/questions/4207134/what-is-the-proper-declaration-of-main">What is the proper declaration of <code>main()</code>?</a> — For C++, with a very good answer indeed.</li>
  <li><a href="https://stackoverflow.com/questions/8692120/styles-of-main-functions-in-c">Styles of <code>main()</code> functions in C</a></li>
  <li><a href="https://stackoverflow.com/questions/10915713/return-type-of-main-method-in-c">Return type of <code>main()</code> method in C</a></li>
  <li><a href="https://stackoverflow.com/questions/9356510/int-main-vs-void-main-in-c"><code>int main()</code> vs <code>void main()</code> in C</a></li>
  </ul>
  <p>Related:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/5191965/c-int-mainint-argc-char-argv">C++ — <code>int main(int argc, char **argv)</code></a></li>
  <li><a href="https://stackoverflow.com/questions/5217395/c-int-mainint-argc-char-argv">C++ — <code>int main(int argc, char *argv[])</code></a></li>
  <li><a href="https://stackoverflow.com/questions/10321435/is-char-envp-as-a-third-argument-to-main-portable">Is <code>char *envp[]</code> as a third argument to <code>main()</code> portable?</a></li>
  <li><a href="https://stackoverflow.com/questions/18402853/must-the-int-main-function-return-a-value-in-all-compilers">Must the <code>int main()</code> function return a value in all compilers?</a></li>
  <li><a href="https://stackoverflow.com/questions/5296163/why-is-the-type-of-the-main-function-in-c-and-c-left-to-the-user-to-define">Why is the type of the <code>main()</code> function in C and C++ left to the user to define?</a></li>
  <li><a href="https://stackoverflow.com/questions/22239/why-does-int-main-compile">Why does <code>int main(){}</code> compile?</a></li>
  <li><a href="https://stackoverflow.com/questions/26470912/legal-definitions-of-main-in-c14">Legal definitions of <code>main()</code> in C++14?</a></li>
  </ul>