0

In C programming, what is the difference between return 0 and return 1? And why this return 1 also executes my program?

13th Apr 2021, 7:53 AM
kushagra saruparia
3 ответов
+ 3
Return value of any function ( including main() ) doesn't have any effect on the execution of the program, if you want you can even try returning your age and it will work without any problem till the time the value can be converted to the return type of the function. return value of main() is generally used as exit status of the program, and 0 is just a value which by convention is considered to represent sucessful execution.
13th Apr 2021, 8:03 AM
Arsenic
Arsenic - avatar
0
return 0 means success,else error(most of the time)..os will get this value if other processes dont really care about ur process' status, then it doesnt really matter what value u return
13th Apr 2021, 8:09 AM
durian
durian - avatar
0
U can also use return Exit_Success ; for successful compilation and return Exit_failur; instead of return 0
13th Apr 2021, 12:20 PM
A S Raghuvanshi
A S Raghuvanshi - avatar