Question:What will be output when you will execute following c code?#include<stdio.h>
void main(){
if(0xA)
if(052)
if('\xeb')
if('\012')
printf("Tom hanks");
else;
else;
else;
else;
}
A Tom hanks
B Compilation error: Misplaced else
C Compilation error: If without any body
D Compilation error: Undefined symbol
E Warning: Condition is always true
+ ExplanationoxA: It is hexadecimal integer constant.
052: It octal integer constant.
‘xeb’: It is hexadecimal character constant.
‘ 12’: It is octal character constant.
As we know in c zero represents false and any non-zero number represents true. All of the above constants return a non-zero value. So all if conditions in the above program are true.
In c it is possible to write else clause without any body.