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
What is the purpose of the C preprocessor in C programming?
A. Compile C code
B. Optimize code
C. Preprocess code before compilation
D. Execute code
A. #define
B. #include
C. #ifdef
D. #pragma
What is the purpose of the #define directive in C preprocessing?
A. To include a header file
B. To define a macro
C. To declare a constant
D. To declare a variable
In C, which directive is used to conditionally include code based on preprocessor macros?
A. #ifdef
B. #ifndef
C. #if
D. #else
Join The Discussion