Thursday, 5 March 2015

The exit Function in C

The exit function (defined in the header file stdlib.h) is used to terminate the running program with a specific exit code. It takes the following form:

exit (int exit-code)

The exit-code is used by the operating systems and may also be used by the calling program. By convention, an exit-code of 0 indicates a normal exit where as any other value indicates an abnormal exit or an error. If a program is to be terminated before the return 0; statement in within the main function following code can be used:

exit (0);

No comments:

Post a Comment