July 2019
Intermediate to advanced
458 pages
12h 12m
English
In C, the types of integers available have a number of similarities with Go, since there are signed and unsigned versions of each integer type in both languages, but they differ in terms of name and byte size. The C sizeof function makes it possible to check the size for each of these types.
Here is a list of integer types that are available in C:
Signed types
| Type | Size | Range |
| char | 1 byte | [-128, +127] |
| int | 2 or 4 bytes | see short and long |
| short | 2 bytes | [-32 768, +32 767] |
| long | 4 bytes | [-2 147 483 648, +2 147 483 647] |
| long long | 8 bytes | [-9 223 372 036 854 775 808, +9 223 372 036 854 775 807] |
Unsigned types
| Type | Size | Range |
| unsigned char | 1 byte | [0, +255] |
| unsigned int | 2 or 4 bytes | see unsigned short or unsigned ... |
Read now
Unlock full access