why we use return 0; ??? what if we return 5;???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why we use return 0; ??? what if we return 5;????

19th Nov 2016, 8:35 AM
BAWALa a unsung hero
BAWALa a unsung hero - avatar
2 Answers
+ 4
Really you can return another value. But please, write about it in your program documentation and help. Because that returned value can be checked after ending the program in system. It is not automatic, but admin can added this check in some batch calling. And the standard is, "returned 0 means program ended OK, another value - a program ended with any fault"... So you can change it in your program, but write about it in your program documentation and help....
19th Nov 2016, 10:05 AM
Petr Hatina
Petr Hatina - avatar
+ 2
it doesn't matter. it's true if you use return5; as the main function supposed to return an integer, you have to use it.
19th Nov 2016, 8:38 AM
sahar