0
In C programming, what is the difference between return 0 and return 1? And why this return 1 also executes my program?
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.
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
0
U can also use
return Exit_Success ; for successful compilation and return Exit_failur; instead of return 0