Data type inside struct for bit define

Discussion in 'Embedded Systems and Microcontrollers' started by ep.hobbyiest, Sep 9, 2014.

  1. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    Hello,
    i get confuse when i do define struct of bits. Means 2 bits for Var_1, 3 bits for Var_2, 4 bits for Var_4 and so on..
    so what is variable is to define wheather char, unsigned char , int or something else..
    my example as follows.
    Code (Text):
    1.  
    2. struct
    3. {
    4.  unsigned char Var_1:1;
    5. char Var:2;
    6. int Var:3;
    7. };
    8.  
    9. so what is good to use. Any how we need only bits.
     
Loading...