0
Why do we type return 0 at the end of a program
what will happen if I type return 1
2 Answers
+ 2
The return value of the main function is considered the "Exit Status" of the application to the most of the operating systems and returning 0 value is a success status that tell the OS that program has terminated properly and safely.
- 1
0 is a stand in for None. That is, no error occurred. When your program fails it will return 1: Something went wrong. In the past, people would sometimes define special error codes. So the program might return 5 on a certain problem.