Is it possible to create a data type of length one bit in C

后端 未结 8 1966
醉话见心
醉话见心 2020-12-09 16:28

Esentially I want to create a data type uint1_t. Is that even possible?

I know the size of the bool data type is one byte. But boolean values only need

8条回答
  •  醉话见心
    2020-12-09 16:58

    No. 8 bits is the minimum size for a type. You can use a bit field to combine multiple "small" elements together if you really needed sub-byte storage.

    However this is rarely a big deal. Machines have lots of memory and it is rarely necessary to worry about this kind of memory waste.

提交回复
热议问题