11.1.7 The bool type

博客介绍了bool类型,它代表布尔逻辑量,值为true和false,与其他类型无标准转换,和整数类型不同,bool值与整数值不能互换。还提及在C、C++和C#中,不同类型与bool类型转换的方式。
11.1.7 The bool type
The bool type represents boolean logical quantities. The possible values of
type bool are true and false.
No standard conversions exist between bool and other types. In particular,
the bool type is distinct and
separate from the integral types, and a bool value cannot be used in place
of an integral value, and vice
versa.
[Note: In the C and C++ languages, a zero integral or floating-point value,
or a null pointer can be converted
to the boolean value false, and a non-zero integral or floating-point
value, or a non-null pointer can be
converted to the boolean value true. In C#, such conversions are
accomplished by explicitly comparing an
integral or floating-point value to zero, or by explicitly comparing an
object reference to null. end note]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值