37. What will be the output of following code :
// Assume all header files are included
main()
{
int i=5;
printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);
}
A. 89
B. 45545
C. 78945
D. Runtime Error
View Answer & Explanation
Ans. b
Explanation : The arguments in a function call are pushed into the stack from left to right.The evaluation is by popping out from the stack. and the evaluation is from right to left,hence the result.
.
38. What will be the output of following code :
// Assume all header files are included
#include <stdio.h>
#define a 10
main()
{
#define a 50
printf("%d",a);
}
A. 60
B. 50
C. 51
D. Runtime Error
View Answer & Explanation
Ans. b
Explanation : The preprocessor directives can be redefined anywhere in the program. So the most recently assigned value will be taken.
