0

Why do we type return 0 at the end of a program

what will happen if I type return 1

10th Apr 2017, 4:18 AM
lohit jena
lohit jena - avatar
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.
10th Apr 2017, 4:38 AM
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender)
à€Šà„‡à€”à„‡à€‚à€Šà„à€° à€źà€čà€Ÿà€œà€š (Devender) - avatar
- 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.
10th Apr 2017, 4:36 AM
1of3
1of3 - avatar