[Davis@localhost UNS]$ gcc U_bc.c
[Davis@localhost UNS]$ ./a.out
a=d i=100 f=0.000000
sizeof(u)=4
[Davis@localhost UNS]$ cat U_bc.c
int main()
{
union test
{
char ch;
float f;
int i;
};
//union test u={'a',21,34.65}; gives a warning excess elements
union test u={100.23};
printf("a=%c i=%d f=%f\n",u.ch,u.i,u.f);
printf("sizeof(u)=%d\n",sizeof(u));
return 0;
}
in the above program it is interpreting the float value as char & int but float value is not getting interpreted.