C++中的数据类型及其范围

    2021/05/13 20:15 下午 标签: #编程

    符号属性 长度属性 基本型 所占位数 取值范围
    -- -- char 8 \([-2^7,2^7-1]\)
    signed -- char 8 \([-2^7,2^7-1]\)
    unsigned -- char 8 \([0,2^8-1]\)
    [signed] short [int] 16 \([-2^{15},2^{15}-1]\)
    unsigned short [int] 16 \([0,2^{16}-1]\)
    [signed] -- int 32 \([-2^{31},2^{31}-1]\)
    unsigned -- [int] 32 \([0,2^{32}-1]\)
    [signed] long [int] 32 \([-2^{31},2^{31}-1]\)
    unsigned long [int] 32 \({[0,2^{32}-1]}\)
    [signed] long long [int] 64 \([-2^{63},2^{63}-1]\)
    unsigned long long [int] 64 \([0,2^{64}-1]\)
    -- -- float 32 \((-3.40282\times10^{38},3.40282\times10^{38})\)
    -- -- double 64 \((-1.79769\times10^{38},1.79769\times10^{38})\)
    -- long double 96 \((-1.79769\times10^{308},1.79769\times10^{308})\)