c union and bitfields

divya picture divya · Jun 21, 2010 · Viewed 12.2k times · Source

Can bitfields be used in union?

Answer

AnT picture AnT · Jun 21, 2010

Yes, they can be. Why not? Bit-fields in unions behave in the same way they behave anywhere else. There's nothing special about bit-fields in unions (or unions with bit-fields).