Exit
exit is a standard-library function that terminates normal program execution after performing required termination processing, without ordinarily unwinding active automatic objects.
Modern C, Third Edition
exit is a C standard-library function that terminates normal program execution and performs implementation-defined cleanup for the process.
- How it is used
- Terminates normal control flow from a function and communicates program success or failure to the runtime system.
- How deep it goes
- Defines termination equivalence, nonreturning behavior, status values, cleanup, and error-handling use, but not detailed handler mechanics.
- Examples
- Uses failed puts output, perror diagnostics, EXIT_FAILURE, and the exit prototype as concrete examples.
- What you can do after
- Apply it to terminate from nested control flow after diagnosing an unrecoverable library failure.
Modern C
exit is the C standard library function that terminates normal program execution after performing the standard termination processing.
- How it is used
- Uses exit to terminate normal control flow from functions other than main.
- How deep it goes
- Defines the prototype, status equivalence, nonreturning behavior, and cleanup implications, but defers implementation details.
- Examples
- Shows exit declarations, main status handling, and an atexit cleanup handler that reports termination.
- What you can do after
- Apply it to terminate execution from a nested function while communicating success or failure and preserving normal cleanup.
Related concepts
- entry pointequivalent to · An entry point is a designated starting location or interface through which a program, component, process, or interaction begins.
- destructorcontrasts with · A destructor is an operation associated with an object or value that performs cleanup when its lifetime ends.
- atexitconfigured by · atexit is a C standard-library function that registers a function to execute during normal program termination.
- quick_exitalternative to · quick_exit is a C standard-library function that terminates a program after invoking functions registered with at_quick_exit.
- functionkind of · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

