int
,long
,long long
andshort
Type | Minimum Size | Minimum Number Range |
---|---|---|
int |
16 bits | -32767 ~ +32767 |
long |
32 bits | -2,147,483,647 ~ +2,147,483,647 |
long long |
64 bits | -9.22 * 10^18 ~ +9.22 * 10^18 |
short |
16 bits | -32767 ~ +32767 |
- unsigned and signed
A signed type represents negative or positive numbers (including zero).
An unsigned type represents only values greater than or equal to zero.
For a type of same size, if the number range of signed type is -n ~ +n
, then the number range of unsigned type is 0 ~ 2*n+1
.
float
anddouble
Type | Minimum Size |
---|---|
float |
6 significant digits (usually 32 bits) |
double |
10 significant digits (usually 32 bits) |