exit 1. (programming) A library function in the C and Unix run-time library that causes the program to terminate and return control to the shell. The alternative to calling "exit" is simply to "fall off the end" of the program or its top-level, main, routine.
Equivalent functions, possibly with different names, exist in pretty much every programming language, e.g. "exit" in Microsoft DOS or "END" in BASIC. On exit, the run-time system closes open files and releases other resources. An exit status code (a small integer, with zero meaning OK and other values typically indicating some kind of error) can be passed as the only argument to "exit"; this will be made available to the shell. Some languages allow the programmer to set up exit handler code which will be called before the standard system clean-up actions. 2. Any point in a piece of code where control is returned to the caller, possibly activating one or more user-provided exit handlers. This might be a return statement, exit call (in sense 1 above) or code that raises an error condition (either intentionally or unintentionally). If the exit is from the top-level routine then such a point would typically terminate the whole program, as in sense 1. Last updated: 2008-05-15