The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

return Statement in Program Termination (C++)

Issuing a return statement from main is functionally equivalent to calling the exit function. Consider the following example:

// return_statement.cpp
#include <stdlib.h>
int main()
    exit( 3 );
    return 3;

The exit and return statements in the preceding example are functionally identical. However, C++ requires that functions that have return types other than void return a value. The return statement allows you to return a value from main.

Community Additions

© 2014 Microsoft