Can a bool variable store more than 0x01?

后端 未结 6 1132
慢半拍i
慢半拍i 2021-01-21 09:48
#include 
#include 

using namespace std;

int main()
{
    bool a = 0x03;
    bitset<8> x(a);
    cout<

        
6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-21 10:08

    C++11, §3.9.1/6:

    Values of type bool are either true or false. [...]

提交回复
热议问题