main function - what is the point of a return value?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/204476/what-should-main-return-in-c-c">What should main() return in C/C++?</a><br>
  <a href="http://stackoverflow.com/questions/3309042/what-does-main-return">What does main return?</a>  </p>
</blockquote>



<p>I've been wondering this for a while: what is the purpose of a <code>return 0;</code> statement at the end of the main() function?  </p>

<p>I know that a return statement at the end most functions returns a value to the function which called it.  However, as I understand it, the main function is the starting and ending point of the program, so I'm a little confused as to why it has a return type at all?</p>

<pre><code>main()
{
  //code goes here

  return 0; // &lt;-- what is the point of this return statement?
}
</code></pre>

<p>edit:  I'm pretty new to programming (first year computer science student) and after looking at some of the answers it sounds like the return statement is used to tell the caller of the function if it has completed successfully.  Other than the OS and command line, is there anything else that can call a main function?  thanks for the quick answers =)</p>
