output wud be:
0.000000
float value= 00.0
integer value=1
1 1 1 0.000000

On Sat, Aug 6, 2011 at 2:49 PM, SHIVAM AGRAWAL <[email protected]> wrote:

> any1 plz tell me y output of float type of dis prgrm  is zero?
>
> #include<stdio.h>
> #define INT 1
> main()
> {
>         struct a
>         {
>                 int type;
>         };
>         struct c
>         {
>                 int type;
>                 int e;
>         };
>         struct b
>         {
>                 int type;
>                 float f;
>         };
>         union
>         {
>                 struct a n;
>                 struct b nf;
>                 struct c ni;
>         }all;
>         all.ni.type=INT;
>         all.nf.f=10.43;
>         all.ni.e=1;
>         printf("%f\n",all.nf.f);
>         if(all.nf.type==INT)
>                 printf("float value =%2.1f",all.nf.f);
>         if(all.ni.type==INT)
>                 printf("\ninteger value=%d",all.ni.e);
>         printf("\n%d %d %d %f",all.ni.type,all.nf.type,all.ni.e,all.nf.f);
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to