typedef union{
int a;
char b[10];
float c;
} Union;
int main()
{
Union x,y={100};
x.a=10;
strcpy(x.b,"hello");
x.c=21.50;
printf("%d\t%s\t%f\n",x.a,x.b,x.c);
printf("%d\t%s\t%f\n",y.a,y.b,y.c);
return 0;
}
I have this program where I am able to make out all the outputs except for "x.a" and "y.c". Both these outputs are a bit confusing. I do know that floats are stored in memory in a different way as compared to int, but still I am unable to make out the possible reasons for the output.
Any help will be appreciated.
The outputs are
110792132 21.500000
100 d 0.000000