+ 1
Why i got answer in a int vale like 1093140480 ?
4 Antworten
+ 2
It means it take rendom value in my case value of c is 10.5 float value then it print value of a which is int so display such value 1093140480
+ 1
Because it's an unión and not a structure.
Example :
union u
{
int a;
int b;
}
union u s;
s.a = 10; //a = 10 and b = 10
s.b = 11; //a = 11 and b = 11
So it's the same in your case. a contains the value of a float.
+ 1
But why i got this value 1093140480
+ 1
Let see in binary with an example :
union u
{
char a;
char b;
}
union u s;
s.a = 1; //s = 0000 0001 so s.b = 0000 0001
s.a = 2 //s = 0000 0010 so s.b = 0000 0010
s.b = 10 //s = 0000 1010 so s.a = 0000 1010
In your case, the integer à contains the value of the float c.