finding output of C code

coder12's Avatar
Newbie Member

double i;
void main()
(int )(float)(char) i;
printf("%d",sizeof(int )(float)(char) i));

Give required explanation[/B]
xpi0t0s's Avatar, Join Date: Aug 2004
The only valid explanation of this code is that its author is an idiot.
state's Avatar, Join Date: Sep 2011
Go4Expert Member
Hello there coder12
If these are the exact LOC then you will get an error.
"syntax error before '(' token "
Assuming you mistyped,this is a question related to type casting.So what happens is i is casted to char then float and finally to int.As a result you get the o/p -->4(mingw).I don't think the output will vary much if you are using GCC.The gist of the matter is :sizeof(int).Type casts have R to L associativity
Hope this helps