C 資料型態(datatype)

from http://note1.pixnet.net/blog/post/11569643-%E8%B3%87%E6%96%99%E5%9E%8B%E6%85%8B%28datatype%29

關鍵字位長範圍printf chars
char1-128..127 (或0..255,與體系結構相關) %c
unsigned char10..255 
signed char1-128..127 
int2
(Dos或win16)
or
4
(win32或unix)
-32768..32767


 or


-2147483648..2147483647
 %i, %d
unsigned int2
(Dos或win16)
or
4
(win32或unix)
0..65535


or


0..4294967295
 %u
signed int2
(Dos或win16)
or
4
(win32或unix)
-32768..32767


or


-2147483648..2147483647
 %i, %d
short int2-32768..32767 %hi
unsigned short20..65535 %hu
signed short2-32768..32767 
long int4-2147483648..2147483647 %li, %ld
unsigned long40..4294967295 %lu
signed long4-2147483648..2147483647 
long long8-9223372036854775808..9223372036854775807 %lli
unsigned long long80..18446744073709551615 %llu
float43.4x10-38..3.4x10+38 (7 sf) %f, %e, %g
double81.7x10-308..1.7x10+308 (15 sf) %f, %e, %g
long double8 或以上編譯器相關 %Lf, %Le, %Lg

留言

熱門文章