Determine Output:
#define square(x) x*x
void main()
{
int i;
i = 64/square(4);
printf("%d", i);
}
#define square(x) x*x
void main()
{
int i;
i = 64/square(4);
printf("%d", i);
}
A. 4
B. 64
C. 16
D. None of These
Answer: Option B
Solution(By Examveda Team)
The macro call square(4) will substituted by 4*4 so the expression becomes i = 64/4*4 . Since / and * has equal priority the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64
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
Join The Discussion