關鍵字 | 位長 | 範圍 | printf chars |
char | 1 | -128..127 (或0..255,與體系結構相關) | %c |
unsigned char | 1 | 0..255 | |
signed char | 1 | -128..127 | |
int | 2 (Dos或win16) or 4 (win32或unix) | -32768..32767 or -2147483648..2147483647 | %i, %d |
unsigned int | 2 (Dos或win16) or 4 (win32或unix) | 0..65535 or 0..4294967295 | %u |
signed int | 2 (Dos或win16) or 4 (win32或unix) | -32768..32767 or -2147483648..2147483647 | %i, %d |
short int | 2 | -32768..32767 | %hi |
unsigned short | 2 | 0..65535 | %hu |
signed short | 2 | -32768..32767 | |
long int | 4 | -2147483648..2147483647 | %li, %ld |
unsigned long | 4 | 0..4294967295 | %lu |
signed long | 4 | -2147483648..2147483647 | |
long long | 8 | -9223372036854775808..9223372036854775807 | %lli |
unsigned long long | 8 | 0..18446744073709551615 | %llu |
float | 4 | 3.4x10-38..3.4x10+38 (7 sf) | %f, %e, %g |
double | 8 | 1.7x10-308..1.7x10+308 (15 sf) | %f, %e, %g |
long double | 8 或以上 | 編譯器相關 | %Lf, %Le, %Lg |
https://msdn.microsoft.com/zh-tw/library/s3f49ktz.aspx
沒有留言:
張貼留言