VC中各数据类型所表示的范围和占用的字节数是多大?

char -128 ~ +127 (1 Byte)
short -32767 ~ + 32768 (2 Bytes)
unsigned short 0 ~ 65536 (2 Bytes)
int -2147483648 ~ +2147483647 (4 Bytes)
unsigned int 0 ~ 4294967295 (4 Bytes)
long == int
long long -9223372036854775808 ~ +9223372036854775807 (8 Bytes)

unsigned long long的最大值:1844674407370955161

double 1.7 * 10^308 (8 Bytes)

以上结果已经很明白了,补充说明下:
关于带符号与无符号类型:整型 int、stort  和  long 都默认为带符号型。要获得无符号型则必须制定该类型为unsigned,比如unsigned long。unsigned int类型可以简写为unsigned,也就是说,unsigned后不加其他类型说明符就意味着是unsigned int。

你可能感兴趣的:(VC中各数据类型所表示的范围和占用的字节数是多大?)