Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of the following are correct preprocessor directives in C?

1. #ifdef

2. #if

3. #elif

4. #undef

  • A.1, 2
  • B.4
  • C.1, 2, 4
  • D.1, 2, 3, 4

Answer: D

Correct answer: 1, 2, 3, 4

All four are real directives: #ifdef tests whether a macro is defined, #if evaluates a constant expression, #elif is the “else if” of the conditional group, and #undef removes a definition.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.