Functions HI-TECH C ATEXIT
#include <stdlib.h> int atexit(void (*func)(void));
The atexit() function registers the function pointed to by func, to be called without arguments at normal program termination. Ateixt() returns zero if the registration succeeds, nonzero if it fails. On program termination, all functions registered by atexit() are called, in the reverse order of their registration.