Calling a function On termination of main() in C


Dear readers, A friend of mine taught me this new “trick” where you can call a function when the main() in C exits. In the Library “stdlib.h” there exists a function int atexit(void (*func)(void)) the “func” is any function without any arguments. The atexit() calls the function that you register as soon as the main() … More Calling a function On termination of main() in C