I know when the address of the function is passed to atexit function,
the function is excuted.
#include <stdlib.h>
int atexit(void (*func) void));
However, what is the purpose of using atexit function?
Does verbal meaning itself ‘exit’ relate to atexit function?
atexitwould be used for some code that you want to execute when the application terminates, regardless of where it was exited from. One example would be an application-wide logger. You would callatexit(flush_log), so when the application exits, the log will be flushed, without the developer having to remember to flush it.