0

I am using a union and an anonymous structure inside it. I want to know how I can initialize the structure members inside it. how can i do that? Please help :)

typedef union
{
    uint8_t All;                
    struct
    {
        uint8_t G:1;            
        uint8_t O_B:1;         
        uint8_t Unused:1;       
        uint8_t W1:1;          
        uint8_t W2:1;          
        uint8_t Y1:1;          
        uint8_t Y2:1;           
        uint8_t IAQ:1;          
    };
} _UNION_VARIABLE;

_UNION_VARIABLE bit_field_array[5] = { {.G=1, .O_B=0, ...}, {.G=0, .O_B=1, ...},.....};

Is this correct?

Ananth
  • 21
  • 8

0 Answers0