前幾天筆試發現這個問題有點模糊,囧,記錄一下:
- 1字節(byte) = 8位(bit)
在16位的系統中(比如8086微機) 1字 (word)= 2字節(byte)= 16(bit)
在32位的系統中(比如win32) 1字(word)= 4字節(byte)=32(bit)
在64位的系統中(比如win64)1字(word)= 8字節(byte)=64(bit)
另外,只有char類型是被規定為8位,其他數據類型都沒有被強制規定具體位數
C類型 | 32 | 64 |
char | 1 | 1 |
short int | 2 | 2 |
int | 4 | 4 |
long int | 4 | 8 |
long long int | 8 | 8 |
char* | 4 | 8 |
float | 4 | 4 |
double | 8 | 8 |