Header file:
stdlib.h
Synopsis:
int atexit(void (*func)(void));
Description:
It registers the function func to be called at the normal process termination.
atexit function C example:
#include<stdio.h>
#include<stdlib.h>
void atexit_test() {
printf("Inside atexit_test function\n");
}
int main() {
printf("Calling atexit_text() function\n");
return(atexit(atexit_test));
}
#include<stdlib.h>
void atexit_test() {
printf("Inside atexit_test function\n");
}
int main() {
printf("Calling atexit_text() function\n");
return(atexit(atexit_test));
}
Output:
jp@jp-VirtualBox:~/$ ./a.out
Calling atexit_text() function
Inside atexit_test function
Calling atexit_text() function
Inside atexit_test function
No comments:
Post a Comment