Skip to content
Related Articles

Related Articles

Improve Article

C | Macro & Preprocessor | Question 12

  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021
Geek Week

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

Take a step-up from those “Hello World” programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.
My Personal Notes arrow_drop_up
Recommended Articles
Page :