What header file is needed for the function exit()?

  1. stdlib.h

  2. conio.h

  3. dos.h

  4. ctype.h


Correct Option: A

AI Explanation

To answer this question, you need to understand the purpose of the exit() function and which header file it belongs to.

The exit() function is used to terminate a program and return control to the operating system. It is defined in the stdlib.h header file, so the correct answer is option A) stdlib.h.

Let's go through each option to understand why it is correct or incorrect:

Option A) stdlib.h - This option is correct because the exit() function is defined in the stdlib.h header file. Option B) conio.h - This option is incorrect because the conio.h header file is used for console input/output functions and does not contain the exit() function. Option C) dos.h - This option is incorrect because the dos.h header file is used for accessing DOS-specific functions and does not contain the exit() function. Option D) ctype.h - This option is incorrect because the ctype.h header file is used for character handling functions and does not contain the exit() function.

The correct answer is option A) stdlib.h. This option is correct because the exit() function is defined in the stdlib.h header file.

Find more quizzes: