持续更新中
持续更新中
持续更新中
一、基本类型
1、Java
- boolean:1 字节,true、false
- byte:1 字节,-128 ~ 127
- short:2 字节,-32768 ~ 32767
- int:4 字节,-2147483648 ~ 214748367
- long:8 字节,
- char:2 字节,0 ~ 65535
- float:4 字节
- double:8 字节
2、C
- bool:1 字节,true、false
- char:注意,其默认符号性由编译器决定
- unsigned char:1 字节,0 ~ 255
- signed char:1字节,-128 ~ 127
- short [int]:默认有符号
- unsigned short [int]:2 字节,0 ~ 65535
- [signed] short [int]:2 字节,-32768 ~ 32767
- int:默认有符号
- unsigned int:4 字节,-2147483648 ~ 214748367
- [signed]:4 字节,0 ~ 4294967295
- long [int]:默认有符号
- unsigned short [int]:4 字节(Linux x86)/8 字节(Linux x86_64)
- [signed] short [int]:4 字节(Linux x86)/8 字节(Linux x86_64)
- long long int:默认有符号
- unsigned long long [int]:8 字节
- [signed] long long [int]:8 字节
- float:4 字节
- double:8 字节
- long double:16 字节(Linux x86_64)
- void:
$ gcc main.c -pedantic main.c: In function 'main': main.c:5:39: warning: invalid application of 'sizeof' to a void type [-Wpedantic] printf("sizeof(void): %d\n", sizeof(void)); ^ $ ./a.out sizeof(void): 1 $

被折叠的 条评论
为什么被折叠?



