Namespaces
Variants
Actions

exit

From cppreference.com
< c‎ | program
Defined in header <stdlib.h>
void exit( int exit_code );
(until C11)
_Noreturn void exit( int exit_code );
(since C11)
(until C23)
[[noreturn]] void exit( int exit_code );
(since C23)

Causes normal program termination to occur.

Several cleanup steps are performed:

  • functions passed to atexit are called, in reverse order of registration
  • all C streams are flushed and closed
  • files created by tmpfile are removed
  • control is returned to the host environment. If exit_code is zero or EXIT_SUCCESS, an implementation-defined status indicating successful termination is returned. If exit_code is EXIT_FAILURE, an implementation-defined status indicating unsuccessful termination is returned. In other cases implementation-defined status value is returned.

Contents