0

why is return 0 is used at the end of c program ?

24th Feb 2018, 6:14 AM
jayesh kshirsagar
jayesh kshirsagar - avatar
3 ответов
+ 13
It is the Exit status of the program.. since the return type of main function is int it requires an integer value as return... most os consider 0 as no error & non-zero as error in program... & it is also there in C++ standard so I guess u should write it even if it is not mandatory...
24th Feb 2018, 8:22 AM
🌛DT🌜
🌛DT🌜 - avatar
+ 3
It’s an agreement. Program return 0 at the end if no errors occurred and 1 if opposite
24th Feb 2018, 6:17 AM
Leshark
Leshark - avatar
+ 1
is it mandatory to use every time ?
24th Feb 2018, 6:16 AM
jayesh kshirsagar
jayesh kshirsagar - avatar