Skip to content

Commit

Permalink
add exit
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar.rathi36 committed Feb 25, 2025
1 parent 8e3930a commit 90c111b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions sagar/exit_handler/exit.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include<unistd.h>
#include<stdio.h>

static void my_exit1(void);
static void my_exit2(void);

int main(void)
{
if(atexit(my_exit2) != 0)
printf("can not register my exit2 \n");
if(atexit(my_exit1) != 0)
printf("can not register my exit1 \n");
if(atexit(my_exit1) != 0)
printf("can not register my exit \n");
printf("main is done \n");
return 0;

}

static void my_exit1(void)
{
printf("first exit handler \n");

}


static void my_exit2(void)
{
printf("second exit handler \n");

}

0 comments on commit 90c111b

Please sign in to comment.