Open In App

C | Macro & Preprocessor | Question 12

Like Article
Like
Save
Share
Report

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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads