在C语言中,double、long、unsigned、int、char类型数据所占字节数及范围


32位编译器

char/bool :1个字节

char*(即指针变量): 4个字节(32位的寻址空间是2^32, 即32个bit,也就是4个字节。同理64位编译器)

short int : 2个字节

int: 4个字节

unsigned int : 4个字节

float: 4个字节

double: 8个字节

long: 4个字节

long long: 8个字节

unsigned long: 4个字节

 

类型 存储空间大小 最小值 最大值
char (与 signed char 或 unsigned char 相同)  
              -128 127
unsigned char 1个字节 0 255
signed char 1个字节 -128 127
int 2个或4个字节 -32 768 或 -2 147 483 648 32767 或 2 147 483 647
unsigned int 2个或4个字节 0 65 535 或 4 294 967 295
short 2个字节 -32 768 32 767
unsigned short 2个字节 0 65 535
long 4个字节 -2 147 483 648 2 147 483 647
unsigned long 4个字节 0 4 294 967 295
long long (C99) 8个字节 -9 223 372 036 854 775 808 9 223 372 036 854 775 807
Unsigned long long (C99) 8个字节 0 18 446 744 073 709 551 615

 

参考博客:https://blog.csdn.net/lyl0625/article/details/7350045

http://c.biancheng.net/view/177.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM