C | Macro & Preprocessor | Question 12
Predict the output of following program?
#include <stdio.h> #define MAX 1000 int main() { int MAX = 100; printf("%d ", MAX); return 0; } |
chevron_right
filter_none
(A) 1000
(B) 100
(C) Compiler Error
(D) Garbage Value
Answer: (C)
Explanation: After preprocessing stage of compilation, the function main() changes to following
int main()
{
int 1000 = 100; // COMPILER ERROR: expected unqualified-id before numeric constant
printf("%d ", 1000);
return 0;
}
Recommended Posts:
- C | Macro & Preprocessor | Question 2
- C | Macro & Preprocessor | Question 9
- C | Macro & Preprocessor | Question 8
- C | Macro & Preprocessor | Question 7
- C | Macro & Preprocessor | Question 6
- C | Macro & Preprocessor | Question 5
- C | Macro & Preprocessor | Question 4
- C | Macro & Preprocessor | Question 14
- C | Macro & Preprocessor | Question 1
- C | Macro & Preprocessor | Question 13
- C | Macro & Preprocessor | Question 15
- C | Macro & Preprocessor | Question 11
- C | Macro & Preprocessor | Question 14
- C | Macro & Preprocessor | Question 10
- The OFFSETOF() macro



