Atexit() - C library function Program


Declaration :

Explanation :

Purpose The C library function int atexit(void (*func)(void)) causes the specified function func to be called when the program terminates. You can register your termination function anywhere you like but it will be called at the time of program termination.
Parameters func ===> This is the function to be called at the termination of the program.
Return Value This function returns a zero value if the function is registered successfully otherwise a non-zero value if it is failed.
Exception

C Program : Example

The following example shows the usage of atexit() function.