| Name | Description | Notes | Source | Availability | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
INT8_ |
Maximum value of
int8_t |
L | ? | M | <stdint.h> |
C99 | C11 | ||||
INT8_ |
Minimum value of
int8_t |
L | ? | M | <stdint.h> |
C99 | C11 | ||||
int8_t |
Signed integer type of exactly 8 bits | L | ? | T | <stdint.h> |
C99 | C11 | ||||
PRId8 |
Decimal output conversion specifier for
int8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIi8 |
Decimal output conversion specifier for
int8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIo8 |
Octal output conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIu8 |
Decimal output conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIX8 |
Hexdecimal output conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIx8 |
Hexdecimal output conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNd8 |
Decimal input conversion specifier for
int8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNi8 |
General input conversion specifier for
int8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNo8 |
Octal input conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNu8 |
Decimal input conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNx8 |
Hexdecimal input conversion specifier for
uint8_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
UINT8_ |
Maximum value of
uint8_t |
L | ? | M | <stdint.h> |
C99 | C11 | ||||
uint8_t |
Unsigned integer type of exactly 8 bits | L | ? | T | <stdint.h> |
C99 | C11 | ||||
uint8_t and
int8_t are optional integer types of exactly 8 bits. Both types
have no padding, and
int8_t uses 2's complement.
uint8_t is unsigned, and has the range zero to
UINT8_,
which is [0, +255].
int8_t is signed, and has the range
INT8_
to INT8_,
which is [−128, +127].
The following macros can be used in the fmt argument of printf to print arguments of types
uint8_t and
int8_t:
PRIu8PRIo8PRIx8PRIX8PRId8PRIi8
The following macros can be used in the fmt argument of scanf to scan arguments of types
uint8_t * and
int8_t *:
SCNu8SCNo8SCNx8SCNd8SCNi8
The existence of macros such as
PRIu8 can be used to detect the existence of
uint8_t with conditional compilation.
Related types:
uint8_tint8_tuint_least8_t int_least8_t uint_fast8_t int_fast8_t
| Property |
uint8_t |
int8_t |
|
|---|---|---|---|
| Width (bits) | 8 | ||
| Lowest value | 0 | −128 | |
| Highest value | +255 | +127 | |
printf |
base 10 | "%"
PRIu8 |
"%"
PRId8 or "%"
PRIi8 |
| base 8 | "%"
PRIo8 |
||
| upper-case base 16 | "%"
PRIX8 |
||
| lower-case base 16 | "%"
PRIx8 |
||
scanf |
base 10 | "%"
SCNu8 |
"%"
SCNd8 |
| base 8 | "%"
SCNo8 |
||
| base 16 | "%"
SCNx8 |
||
| base 16, 8 or 10 by prefix | "%"
SCNi8 |
||