Skip to main content

数据类型和范围

Data TypeAliasSize(bytes)RangeFormat Specifier
signed charint8_t1-128 to 127%c
unsigned charuint8_t10 to 255%c
short intint16_t2-32,768 to 32,767%hd
unsigned short intuint16_t20 to 65,535%hu
intint32_t4-2,147,483,648 to 2,147,483,647%d
unsigned intuint32_t40 to 4,294,967,295%u
long intint64_t4-2,147,483,648 to 2,147,483,647%ld
unsigned long intuint64_t40 to 4,294,967,295%lu
long long int8-(2^63) to (2^63)-1%lld
unsigned long long int80 to 18,446,744,073,709,551,615%llu
float41.2E-38 to 3.4E+38%f
double81.7E-308 to 1.7E+308%lf
long double163.4E-4932 to 1.1E+4932%Lf