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.
Also covered in
What to know first
- float64Float64 is a 64-bit floating-point numeric type, commonly represented by the IEEE 754 binary64 format.
- stringA string is a programming-language value representing textual data as an ordered sequence of characters or encoded units.
Related concepts
- entry pointequivalent to · An entry point is a designated starting location or interface through which a program, component, process, or interaction begins.
- atexitconfigured by · atexit is a C standard-library function that registers a function to execute during normal program termination.
- destructorcontrasts with · A destructor is an operation associated with an object or value that performs cleanup when its lifetime ends.
- functionkind of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- quick_exitalternative to · quick_exit is a C standard-library function that terminates a program after invoking functions registered with at_quick_exit.
Questions about exit
What is exit?
exit is a standard-library function that terminates normal program execution after performing required termination processing, without ordinarily unwinding active automatic objects.
Which Manning books explain exit?
Modern C, Third Edition and Modern C.
What should I know before learning exit?
Manning books that teach exit usually introduce float64, string and unsigned char first.
What is the difference between exit and destructor?
exit is a standard-library function that terminates normal program execution after performing required termination processing, without ordinarily unwinding active automatic objects. A destructor is an operation associated with an object or value that performs cleanup when its lifetime ends.
What is exit a kind of?
Exit is a kind of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may 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.

