#include <stdio.h> #define ISEQUAL(X, Y) X == Y int main() { #if ISEQUAL(X, 0) printf("Geeks"); #else printf("Quiz"); #endif return 0; } |
chevron_right
filter_none
Output of the above program?
(A) Geeks
(B) Quiz
(C) Any of Geeks or Quiz
(D) Compile time error
Answer: (A)
Explanation: The conditional macro #if ISEQUAL(X, 0) is expanded to #if X == 0. After the pre-processing is over, all the undefined macros are initialized with default value 0. Since macro X has not been defined, it is initialized with 0. So, Geeks is printed.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C | Macro & Preprocessor | Question 1
- C | Macro & Preprocessor | Question 2
- C | Macro & Preprocessor | Question 14
- C | Macro & Preprocessor | Question 4
- C | Macro & Preprocessor | Question 6
- C | Macro & Preprocessor | Question 7
- C | Macro & Preprocessor | Question 8
- C | Macro & Preprocessor | Question 9
- C | Macro & Preprocessor | Question 10
- C | Macro & Preprocessor | Question 11
- C | Macro & Preprocessor | Question 12
- C | Macro & Preprocessor | Question 13
- C | Macro & Preprocessor | Question 14
- C | Macro & Preprocessor | Question 15
- Write a C macro PRINT(x) which prints x
- The OFFSETOF() macro
- CRASH() macro - interpretation
- How a Preprocessor works in C?
- C/C++ Preprocessor directives | Set 2
- C | Loops & Control Structure | Question 1

