NAME atexit - register a function to be called at normal process termination SYNOPSIS #include <stdlib.h> int atexit(void (*function)(void)); DESCRIPTION The atexit() function registers the given function to be called at normal process termination, either via exit(3) or via return from the program’s main(). Functions so regis- tered are called in the reverse order of their registration; no arguments are passed. The same function may be registered multiple times: it is called once for each registration.
atexitfunction can be used to add pointers to that array. When the execution of a program ends, every function in the array will be called.