013.数据类型-布尔类型

时间:2021-09-03 23:45:06   收藏:0   阅读:25
#include <iostream>
using namespace std;
int main()
{
    //1.创建bool类型
    bool flag = true;     //true代表真
    bool flag1 = false;     //false代表假


    cout <<flag<< endl;        //本质1
    cout << flag1 << endl;     //本质0

    //2.查看bool类型所占用的内存空间
    cout<<"bool类型占用的内存空间:" << sizeof(bool) << endl; //占用1个字节


    system("pause");
    return 0;
}

 

原文:https://www.cnblogs.com/ceovs/p/15221702.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!