what is the purpose of atexit function?

后端 未结 3 953
迷失自我
迷失自我 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 02:10

    Yes, atexit is related to exit.

    exit can call functions which are automatically called before a program exits. These functions are called exit handlers and are registered by calling atexit function.

    #include                 
    
    main(void) {                        
    atexit(func);
    }
    
    func(void) 
    {
        ...
    }
    

提交回复
热议问题