char, int, long, short, occupied bytes, maximum

1 byte = 8 bits   

Unsigned 8-bit value range = 2^8    

1k=1024 bytes=2^10

1m=1024k

1g=1024m

C language 16-bit editor 32-bit editor 64-bit editor
type of data Occupied bytes Ranges Occupied bytes Ranges Occupied bytes Ranges
char 1 -128~127 1 -128~127 1 -128~127
unsigned char 1 0~256 1 0~256 1 0~256
short int 2 -32768~32767 2 -32768~32767 2 -32768~32767
int 2 -32768~32767 4 -2147483648~2147483647 4 -2147483648~2147483647
unsigned int 2 0~65536 4 0~4294967296 4 0~4294967296
float 4 1.4013E-45~3.4028E+38 4 1.4013E-45~3.4028E+38 4 1.4013E-45~3.4028E+38
double 8 4.9E-324 ~ 1.7977E + 308 8 4.9E-324 ~ 1.7977E + 308 8 4.9E-324 ~ 1.7977E + 308
long 4 -2147483648~2147483647 4 -2147483648~2147483647 8 -2^63 ~ 2^63-1
long long 8 -2^63 ~ 2^63-1 8 -2^63 ~ 2^63-1 8 -2^63 ~ 2^63-1
unsigned long  4 0 ~ 2^32 4 0 ~ 2^32 8 0~2^64
java
type of data Occupied bytes Ranges Defaults
boolean 1 true/false false
byte 1 -128~127 0
short 2 -32768~32767 0
int 4 -2147483648~2147483647 0
long 8 -2^63 ~ 2^63-1 0
char 2 -32768~32767 \u0000 (Unicode means space)
float 4 1.4013E-45~3.4028E+38 0.0f
double 8 4.9E-324 ~ 1.7977E + 308 0.0d

 

Guess you like

Origin blog.csdn.net/qq_35629609/article/details/91439456