out put is :
10.375001
float value =10.4
integer value=1
1 1 1 10.37500

what us the problem ?

On Sat, Aug 6, 2011 at 2:19 AM, SHIVAM AGRAWAL <shivi...@gmail.com> 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 algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
The more you sweat in the field, the less you bleed in war."

Ankit Minglani
NITK Surathkal

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

Reply via email to