atexit with _exit C interview question

atexit with _exit C interview question

Question: In the code below, the atexit() function is not being called. Can you tell why?

void func(void)
    printf("\n Cleanup function called \n");

int main(void)
    int i = 0;


    for(;i<0xffffff _exit="" i="" pre="">
Answer: This behavior is due to the use of function _exit(). This function does not call the clean-up functions like atexit() etc. If atexit() is required to be called then exit() or ‘return’ should be used. appreciates your contribution please mail us the questions you have to so that it will be useful to our job search community

No comments:

Top Blogs