exit in C takes an integer representing the exit status.
Exit success
As a rule, exit status 0 is considered successful or intentional exit caused by the successful execution of the program.
Failure
Output state 1 is considered unsuccessful, and most often this means that the program had to exit for some reason, and it could not successfully complete everything in the normal program flow.
Here's the GNU Resource talking about exit status.
As pointed out by @Als, two constants should be used instead of 0 and 1.
EXIT_SUCCESS defined by the standard as zero.
EXIT_FAILURE not limited to the standard as a single, but many systems implement it as one.
Sam DeHaan Mar 30 2018-12-12T00: 00Z
source share