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

后端 未结 8 1936
醉话见心
醉话见心 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:59

    No this is not possible, uint8_t is the smallest data type. Within struct you could use bit fields, besides that not possible to have a data type of just 1 bit.

    0 讨论(0)
  • 2020-12-09 17:01

    Yes you can create a one bit variable suppose int a:1; You can just assign value to it but cannot scanf it.

    0 讨论(0)
提交回复
热议问题