Introduction

1.7 - Return 0 in main function


The main function is an int function, meaning it returns an integer. The return value indicates how the program exited. If the program runs successfully main should return 0. Non-zero return values, usually 1, indicate that the program exited with a problem.

If omitted, the main function returns 0 by default.

Task

Make the main function returns 0.

  • Change return 1; to return 0 or remove it.
#include <iostream> int main() { std::cout << "The program exited successfully." << std::endl; return 1; }