The function atexit () in C
Int atexit function (void (* func) (void)) calls function func when the program ends. You can register your end function (func function) wherever you like, but this function will be called at the end of the program.
Int atexit function (void (* func) (void)) calls function func when the program ends. You can register your end function (func function) wherever you like, but this function will be called at the end of the program.
Declare the function atexit () in C
Below is the declaration for atexit () in C:
int atexit ( void (* func )( void ))
Parameters
func : This is the function to be called at the end of the program.
Returns the value
This function returns a value of 0 if this function is successfully registered. If it fails, it returns a value other than 0.
For example
The following program C illustrates the usage of atexit () in C:
#include #include void functionA () { printf ( "Vi du mot ham functionAn" ); } int main () { /* Dang ky mot ham ket thuc chuong trinh */ atexit ( functionA ); printf ( "Bat dau chay phan chuong trinh chinh .n" ); printf ( "Thoat chuong trinh chinh .n" ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: Abort () function in C
Next lesson: Function exit () in C
4.3 ★ | 3 Vote
You should read it
Maybe you are interested
Difference between function and formula in Excel
8 little-known Excel functions that can save you a lot of work
How to use the NORMDIST function in Excel - Function that returns the distribution in Excel
Date functions in Excel, DAY, WEEKDAY, MONTH
How to use the SUMIF function in Excel to calculate the sum based on conditions
How to use the Round function in Excel to round numbers and process data