Question
#define X 5+2
void main()
{
int i;
i = X*X*X;
printf("%d",i);
}
What would be output of the program ?
#include<stdio.h>#define X 5+2
void main()
{
int i;
i = X*X*X;
printf("%d",i);
}
Answer: Option B
Was this answer helpful ?
As we know #define is a token pasting preprocessor it only paste the value of micro constant in the program, before the actual compilation start.
So pasting 5+2 in place of X, we have
i = 5+2*5+2*5+2
= 5+10+10+2
= 27
Was this answer helpful ?
Submit Solution