Consider this Simple Program:
#includ<stdio.h>
#include<stdlib.h>
void after_main()
{
printf("\nThis will run while exiting the main function");
}
int main()
{
atexit(after_main);
printf("This is the Main end");
return 0;
}
This will results in
This is the Main end
This will run while exiting the main function
atexit(function_name):
This function call the function which is specified after exiting the main function. It is defined in stdlib header file.