Next Previous Contents

## 3.20 atexit

> Function

>   Register an exit function.

> Header

>   `stdlib.h`

> Declaration

>   `int __fastcall__ atexit (void (*exitfunc) (void));`

> Description

>   `atexit` registers the function pointed to by `exitfunc` as an exit function. Exit functions are called when the program terminates, they are called in LIFO order (the last function registered is called first). `atexit` returns zero on success and a nonzero value on failure.

> Limits

>   - A maximum of 5 exit functions can be registered.
>   - There is no way to unregister an exit function.
>   - The function is only available as fastcall function, so it may only be used in presence of a prototype.
> Availability

>   ISO 9899

> See also

>   abort, exit

> Example

>   None.

Next Previous Contents