Open In App

C | Macro & Preprocessor | Question 13

Like Article
Like
Save
Share
Report

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


Last Updated : 14 Nov, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads