Registers a function that is called without arguments at program termination.
#include <stdlib.h> int atexit (void (*func) (void));
| 0 | Indicates that the registration has succeeded. |
| nonzero | Indicates failure. |
#include <stdlib.h>
#include <stdio.h>
static void hw(void);
main()
{
atexit(hw);
}
static void hw()
{
puts("Hello, world\n");
}
Running this example produces the following output:
Hello, world