+ 12
Consider: int function() { return 0; } int main() { cout << function(); } // outputs 0 The return keyword is used by functions to return a value back to where they are called. Different types of function have different return values and types. E.g. char function() { return 'a'; } bool function() { return true; } etc. In main(), the value 0 is returned to the operating system, signalling that the program has run successfully.
23rd May 2017, 4:46 AM
Hatsy Rei
Hatsy Rei - avatar