Skip to content
Related Articles

Related Articles

C | Macro & Preprocessor | Question 12

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021
Improve Article
Save Article

Predict the output of following program?




#include <stdio.h>
#define MAX 1000
int main()
{
   int MAX = 100;
   printf("%d ", MAX);
   return 0;
}

(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;
}


Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!