Determine Output:
#define int char
void main()
{
int i = 65;
printf("sizeof(i)=%d", sizeof(i));
}
#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.
Join The Discussion
Comments ( 3 )
Related Questions on C Miscellaneous
Determine output:
void main()
{
int const *p=5;
printf("%d", ++(*p));
}
A. 6
B. 5
C. Garbage Value
D. Compiler Error
A. mmm nnn aaa
B. mmmm nnnn aaaa
C. Compiler Error
D. None of These
A. I hate Examveda
B. I love Examveda
C. Error
D. None of These
Determine Output:
void main()
{
static int var = 5;
printf("%d ", var--);
if(var)
main();
}
A. 5 5 5 5 5
B. 5 4 3 2 1
C. Infinite Loop
D. None of These
according to the size of byte that takes "sizeof" to store given data is 1. so the answer should be one
output of the above code is depends upon compiler ( vary compiler to compiler) according to option correct option is "sizeof(i)=2"
Please explain the answer sir