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.

Reply via email to