previous | start | next

main

Here is a sample main function illustrating its required form:


    1   int main()
    2   {
    3     cout << "Hello, World!" << endl;
    4   
    5     return 0;
    6   }

At line 5, to what unit is control being returned??

Answer: To the environment or operating system that was used to begin execution. The return value 0 is by convention used to indicate a successful execution. Other values can be used to indicate some sort of failure in the program's effort to carry out its computation. However, the use of this return value is dependent on the environment that executed the program in the first place. Most of the time the environment ignores this return value.



previous | start | next