#include<conio.h>
double i;
void main()
{
(int )(float)(char) i;
printf("%d",sizeof(int )(float)(char) i));
getch();
}
Give required explanation[/B]
|
Newbie Member
|
|
| 8Nov2012,11:07 | #1 |
|
#include<stdio.h>
#include<conio.h> double i; void main() { (int )(float)(char) i; printf("%d",sizeof(int )(float)(char) i)); getch(); } Give required explanation[/B]
|
|
Mentor
|
![]() |
| 9Nov2012,15:44 | #2 |
|
The only valid explanation of this code is that its author is an idiot.
|
|
Go4Expert Member
|
|
| 10Nov2012,11:05 | #3 |
|
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 |