Hello,world! Part 6

Return



The last instruction in the program is the return statement. The line return 0;terminates the main() function and causes it to return the value 0 to the calling process. A non-zero value (usually of 1) signals abnormal termination.
#include <iostream>
using namespace std;

int main()
{
cout << "Hello world!";
return 0;
}
Try It Yourself

If the return statement is left off, the C++ compiler implicitly inserts "return 0;" to the end of the main() function.
Tap Continue to learn more about functions, return, and other topics.

Comments