Why is a char and a bool the same size in c++?

后端 未结 7 516
暗喜
暗喜 2020-11-29 05:05

I\'m reading The C++ Programming Language. In it Stroustrup states that sizeof(char) == 1 and 1 <= sizeof(bool). The specifics depend

7条回答
  •  庸人自扰
    2020-11-29 05:41

    Because in C++ you can take the address of a boolean and most machines cannot address individual bits.

提交回复
热议问题