Skip to content

Instantly share code, notes, and snippets.

@amitsaha
Created September 14, 2012 22:07
Show Gist options
  • Select an option

  • Save amitsaha/3725235 to your computer and use it in GitHub Desktop.

Select an option

Save amitsaha/3725235 to your computer and use it in GitHub Desktop.
atexit in C
/* Demo of atexit in C
http://www.gnu.org/software/libc/manual/html_node/Cleanups-on-Exit.html
*/
# include<stdio.h>
void cleanup()
{
printf("Program terminated\n");
}
int main(int argc, char **argv)
{
atexit(cleanup);
printf("Onto a Perfectly Normal Termination\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment