首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

整数常量,没有short int,对否?解决方案

2012-09-15 
整数常量,没有short int,对否?整数常量只有:intlongintlonglongint它们都有有符号,无符号,对否?并没有:sho

整数常量,没有short int,对否?
整数常量只有:
int
long int
long long int

它们都有有符号,无符号,对否?


并没有:short int 类型!



[解决办法]
楼上那么多回答的人没有一个理解楼主的问题,真是隔靴搔痒,无怪乎楼主急死了。


整数常量是没有short int的,无论C还是C++各版本的标准都如此。

而整数常量的类型视数值大小及是否带后缀,十进制、八进制还是十六进制均有不同,情况比较复杂,C90是这样说的:


6.1.3.2 integer constants

........
The type ot an integer constant is the tirst ot the corresponding list in which its value can be represented. Unsuffixed decimal int. long int, unsigned long int: unsuftixed octal or hexadecimal: int. unsigned int. long int, unsigned long int: suffixed by the letrer u or U: unsigned int. unsigned long int: suffixed by the letter 1 or L long int.unsigned long int. suttixed by both the letters u or U and 1 or L: unsigned long int.

而C99多了个long long,搞了一张大表,如下:

热点排行