//atexit.c: this program shows how we can call a function after exiting from main() function
#include
#include
void my_func1(void);
void my_func2(void);
int main(int argc, char** argv)
{
atexit(my_func1);
atexit(my_func2);
printf("Inside main\n");
exit(0);
}
void
my_func1(void)
{
printf("\ninside my_func1 ");
}
void
my_func2(void)
{
printf("\ninside my_func2 ");
}
$gcc atexit.c
$./a.out
Inside main
inside my_func2
inside my_func1
Tuesday, September 28, 2010
How we can call a function after exiting from main() Using ATEXIT()
Labels:
ELF/Linker/Loader/libc/Compiler
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment