參考數據類型,一般來說直接用有符號的數值就行了,定義數值類型的時候不加unsigned。
C語言的數值類型如下:
int -2147483648至2147483647
long -2147483648至2147483647
long long的最大值:9223372036854775807至-9223372036854775808
float -3.4 x 10^(-38)至 3.4 x 10^(+38)
double -1.7 x 10^(-308)至 1.7 x 10^(+308)
short -32768至32768
char -128至127
unsigned char 0至255
unsigned int 0至4294967295
unsigned short 0至65535
unsigned long 0至4294967295
unsigned long long 0至18446744073709551615
需要注意的是,大多數8位單片機C語言里面沒有longlong這個數據類型,而且int=short,