engineering computer science MCQ #2135

What is the purpose of `#ifndef` directive?

engineering computer science MCQ #2135

  1. Question 1

    Q1. What is the purpose of `#ifndef` directive?

    • A) To include a header file multiple times
    • B) To prevent multiple inclusions of a header file
    • C) To define a macro
    • D) To undefine a macro

    Answer: To prevent multiple inclusions of a header file

    Explanation: #ifndef directive checks if a symbol is not defined, used to prevent multiple inclusions of the same header file.