Assign function which is called when exit
#include <stdlib.h> #include <stdio.h> void done(void); int main(void) { if(atexit(done)) printf("Error in atexit()."); return 0; } void done(void) { printf("Hello There"); }