Table 2. size differences
char | 16 bits | 8 bits |
short | 16 bits | 16 bits |
int | 32 bits | 16,32 or 64 bits |
long | 64 bits | 32 or 64 bits |
float | 32 bits | 32 bits |
double | 64 bits | 64 bits |
boolean | 1 bit | 1 bit or int |
byte | 8 bits | use char |
long long | N/A | 64 bits |
long double | N/A | 80,96 or 128 bits |
C used to have no boolean types but the C99 standard introduced this type.
With the sizeof keyword one can get the size of a C type in a certain runtime environment.
int size = sizeof(int);
would return either 2, 4 or 8 (bytes).