当前位置:网站首页>02.1.2.逻辑类型 bool
02.1.2.逻辑类型 bool
2022-07-28 09:53:00 【vv1025】
//02.1.2.逻辑类型 bool
//c 语言的逻辑真假用 0 和非 0 来表示。而 C++中有了具体的类型,但其本质,仍是
//一个 char 类型的变量可被 0 和非 0 的数据赋值。
#include <iostream>
#include <stdio.h>
using namespace std;
int main() {
bool flag = true;
if(flag)
printf("flag is true\n");
else
printf("flag is flase\n");
printf("sizeof(flag) = %d sizeof(bool) = %d\n", sizeof(flag), sizeof(bool));
flag = 100;
printf("flag = %d\n", flag);
return 0;
}flag is true
sizeof(flag) = 1 sizeof(bool) = 1
flag = 1
-----------------------------------------------
Process returned: 0 (0x0)
Execution time: 371 ms
Maximum memory use: 276 KB
-----------------------------------------------
Press any key to continue . . .边栏推荐
猜你喜欢

OSPF的LSA及优化

工业品MRO采购网站有哪些优势?一文带你读懂

Time series analysis 41 - time series prediction tbats model

选择供应商服务系统,是大健康产业企业迈向数字化转型的第一步

The blind box of super primitive series will be launched soon, and platofarm will enable more rights and interests

On July 13, 2021, we collapsed like this

The high temperature continues, and public transport enterprises carry out special safety training

高温天气筑牢安全生产防线,广州海珠区开展加油站应急演练
![[ESP32][esp-idf][LVGL7.9] 使用oled iic编译失败](/img/16/e5aa43df6ef9bdbc173fa547c85559.png)
[ESP32][esp-idf][LVGL7.9] 使用oled iic编译失败

Redis面试题必知必会
随机推荐
Extreme deflation and perpetual motion machine model will promote the outbreak of platofarm
The blind box of super primitive series will be launched soon, and platofarm will enable more rights and interests
[OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)
In retaliation for the dismissal of the company, I changed all code comments of the project!
Joint search set
Which strings will be resolved to null by fastjason?
2022-uni-app解析token标准的方式-使用jsrsasign-爬坑过了
CloudCompare&PCL 匹配点采样一致性抑制
Edge团队详解如何通过磁盘缓存压缩技术提升综合性能体验
【JZOF】14剪绳子
腾讯技术专家:解密亿级用户产品 微信、QQ、王者荣耀...全面上云实践!
Installing MySQL for Linux operating system (centos7)
Set of bus related concepts
ES6新特性
Mobile number, fixed line regular expression
手机号,固话正则表达式
Time series analysis 41 - time series prediction tbats model
pkg打包node工程
OSPF的拓展配置,选路原则,防环及重发布
ES(8.1)认证题目