Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   finding output of C code (http://www.go4expert.com/forums/finding-output-c-code-t29265/)

coder12 8Nov2012 11:07

finding output of C code

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

Give required explanation[/B]:crazy:

xpi0t0s 9Nov2012 15:44

Re: finding output of C code
The only valid explanation of this code is that its author is an idiot.

state 10Nov2012 11:05

Re: finding output of C code
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

All times are GMT +5.5. The time now is 02:17.