what is the purpose of atexit function?

后端 未结 3 917
迷失自我
迷失自我 2021-01-21 01:13

I know when the address of the function is passed to atexit function,
the function is excuted.

#include 
int atexit(void (*fun         


        
3条回答
  •  迷失自我
    2021-01-21 01:49

    #include
    int atexit(void (*func)(void));
    

    The above declaration says that we pass the address of a function as the argument to atexit. When this function is called, it is not passed any arguments and is not expected to return a value. The exit function called these functions in reverse order of their registration. Each function is called as many times as they registered.

提交回复
热议问题