
上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人
1.2 常见数据类型及其表达范围
C++中常用的数据类型如下。
• int:整型。
• char:字符型。
• string:字符串型。
• float:浮点型(单精度)。
• double:浮点型(双精度)。
• short:短型。
• long:长型。
• signed:有符号型。
• unsigned:无符号型。
各种数据类型所占的字节数和表达范围如下。
• short:2 bytes,-32768~32767。
• int:4 bytes,-2147483648~2147483647。
• long:4 bytes,-2147483648~2147483647。
• long long:8 bytes,-9223372036854775808~9223372036854775807。
• long double:16 bytes,3.3621e-4932~1.18973e+4932。