Open In App

C | Macro & Preprocessor | Question 13

Output of following C program?




#include<stdio.h>
#define max abc
#define abc 100
  
int main()
{
    printf("maximum is %d", max);
    return 0;
}

(A) maximum is 100
(B) abcimum is 100
(C) 100imum is 100
(D) abcimum is abc


Answer: (A)
Explanation: After pre-processing, the source code becomes:




int main()
{
    printf("maximum is %d", 100);
    return 0;
}

The “max” in maximum is not a token, so it doesn’t match with max while pre-processing.
So, option (A) is correct.
Quiz of this Question

Article Tags :