The exit status is an integer that is passed out of a program depending on whether its execution was successful. In C, a successful termination returns 0
or EXIT_SUCCESS
. An error should result in EXIT_FAILURE
. Both are defined in stdlib.h.
We typically try to keep our standard exit integer to 0
. Other integers may be used for different errors and we don’t want to be overlapping, which can throw us off. We can return 1
for errors we may encounter.
On UNIX-like systems, the underlying syscall called when returning from main
is the exit_group()
call.