The Value main() Returns
Go Up to The main() Function Index
The value returned by main
is the status code of the program; it must be an int. If, however, your program uses the routine exit
(or _exit
) to terminate, the value returned by main
is the argument passed to the call to exit
(or to _exit
).
For example, if your program contains the call
exit(1)
the status code of the program returned by main
is 1
.