main() functions return value?
Anyone please tell me where the main() function of the 'C' language returns its value?
C's main
function returns an int... that int goes to the program which executed it (the parent process, if you will) as an exit status code.
Specifically, on most operating systems, a 0 exit code signifies a normal run (no real errors), and non-zero means there was a problem and the program had to exit abnormally.
The return value if the main() function is used as the exit status code of the program.
In a shell you can get the exit status of a program using $?, example:
./prog
exit_status=$?