ITPub博客

首页 > 应用开发 > IT综合 > int,long,short,unsigned数值范围

int,long,short,unsigned数值范围

原创 IT综合 作者:tigersun3108 时间:2007-08-13 11:05:17 0 删除 编辑

The most common practice today is to set up long long as 64 bits, long as 32 bits, short as 16 bits, and int to either 16 bits or 32 bits, depending on the machine's natural word size. In principle, however, these four types could represent four distinct sizes.

The C standard provides guidelines specifying the minimum allowable size for each basic data type. The minimum range for both short and int is –32,767 to 32,767, corresponding to a 16-bit unit, and the minimum range for long is –2,147,483,647 to 2,147,483,647, corresponding to a 32-bit unit. (Note: For legibility, we've used commas, but C code doesn't allow that option.) For unsigned short and unsigned int, the minimum range is 0 to 65,535, and for unsigned long, the minimum range is 0 to 4,294,967,295. The long long type is intended to support 64-bit needs. Its minimum range is a substantial –9,223,372,036,854,775,807 to 9,223,372,036,854,775,807, and the minimum range for unsigned long long is 0 to 18,446,744,073,709,551,615. (For those of you writing checks, that's eighteen quintillion, four hundred and forty-six quadrillion, seven hundred forty-four trillion, seventy-three billion, seven hundred nine million, five hundred fifty-one thousand, six hundred fifteen in U.S. notation, but who's counting?)

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7280904/viewspace-953344/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 引导加载程序
请登录后发表评论 登录
全部评论
  • 博文量
    11
  • 访问量
    22542