...
The C standard exit()
function is typically used to end a program. It takes one argument, which should be either EXIT_SUCCESS
or EXIT_FAILURE
indicating normal or abnormal termination. It Zero is equally portable and well understood. C99, Section 7.20.4.3 says "If the value of status is zero or EXIT_SUCCESS, an implementation-defined form of the status successful termination is returned." The exit()
function never returns.
Code Block | ||
---|---|---|
| ||
#include <stdlib.h> /* ... */ if (/* something really bad happened */) { exit(EXIT_FAILURE); } |
...