+ 3
I think you are asking about how to implement bit fields and take input into them. Bit fields are used in structs, where you can define a custom type to have an arbitrary number of bits. https://www.tutorialspoint.com/cprogramming/c_bit_fields.htm According to this discussion, you cannot input directly into a bit field because it does not align with an address. You have to input to a temporary variable and then copy the value into the struct member. https://stackoverflow.com/questions/68820520/scanf-input-for-structs-bitfields-in-c
13th Oct 2022, 5:14 AM
Brian
Brian - avatar