类型转换,整数型 ,短整型

类型说明符
数的范围
字节数
int
-32768~32767,即 -2~(2-1)
4
unsigned int
0~65535,即 0~(2-1)
4
short int
-32768~32767,即 -2~(2-1)
2
unsigned short int
0~65535,即 0~(2-1)
2
long int
-2147483648~2147483647,即 -2~(2-1)
4
unsigned long
0~4294967295,即0~(2-1)
4
 
 
整型数据即整数。整型数据的一般分类如下:
  • 基本型:类型说明符为int,在内存中占4个字节。
  • 短整型:类型说明符为short int或short。所占字节和取值范围均与基本型相同。
  • 长整型:类型说明符为long int或long,在内存中占4个字节。 [2] 
  • 无符号型:类型说明符为unsigned。无符号型又可与上述三种类型匹配而构成:
  • 无符号基本型:类型说明符为unsigned int或unsigned。
  • 无符号短整型:类型说明符为unsigned short。
  • 无符号长整型:类型说明符为unsigned long。

 

 

posted @ 2022-02-20 17:09  苏三说v  阅读(715)  评论(0编辑  收藏  举报