What will be the output of the program?
#include<stdio.h>
#define int char
void main()
{
int i = 65;
printf("sizeof(i)=%d", sizeof(i));
}
#include<stdio.h>
#define int char
void main()
{
int i = 65;
printf("sizeof(i)=%d", sizeof(i));
}
A. sizeof(i)=2
B. sizeof(i)=1
C. Compiler Error
D. None of These
Answer: Option B
Solution(By Examveda Team)
Since the #define replaces the string int by the macro char.
So, here i is a variable of type char and not int.
Related Questions on C Preprocessor
A. Takes care of conditional compilation
B. Takes care of macros
C. Takes care of include files
D. Acts before compilation
E. All of the above
A. need not start on a new line
B. need not start on the first column
C. has # as the first character
D. comes before the first executable statement
A. sizeof(i)=2
B. sizeof(i)=1
C. Compiler Error
D. None of These
Join The Discussion