| Name | Description | Notes | Source | Availability | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
INT16_ |
Maximum value of
int16_t |
L | ? | M | <stdint.h> |
C99 | C11 | ||||
INT16_ |
Minimum value of
int16_t |
L | ? | M | <stdint.h> |
C99 | C11 | ||||
int16_t |
Signed integer type of exactly 16 bits | L | ? | T | <stdint.h> |
C99 | C11 | ||||
PRId16 |
Decimal output conversion specifier for
int16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIi16 |
Decimal output conversion specifier for
int16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIo16 |
Octal output conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIu16 |
Decimal output conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIX16 |
Hexdecimal output conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
PRIx16 |
Hexdecimal output conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNd16 |
Decimal input conversion specifier for
int16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNi16 |
General input conversion specifier for
int16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNo16 |
Octal input conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNu16 |
Decimal input conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
SCNx16 |
Hexdecimal input conversion specifier for
uint16_t |
? | M | <inttypes.h> |
C99 | C11 | |||||
UINT16_ |
Maximum value of
uint16_t |
L | ? | M | <stdint.h> |
C99 | C11 | ||||
uint16_t |
Unsigned integer type of exactly 16 bits | L | ? | T | <stdint.h> |
C99 | C11 | ||||
uint16_t and
int16_t are optional integer types of exactly 16 bits. Both types
have no padding, and
int16_t uses 2's complement.
uint16_t is unsigned, and has the range zero to
UINT16_, which is [0, +65535].
int16_t is signed, and has the range
INT16_ to
INT16_, which is [−32768, +32767].
The following macros can be used in the fmt argument of printf to print arguments of types
uint16_t and
int16_t:
PRIu16PRIo16PRIx16PRIX16PRId16PRIi16
The following macros can be used in the fmt argument of scanf to scan arguments of types
uint16_t * and
int16_t *:
SCNu16SCNo16SCNx16SCNd16SCNi16
The existence of macros such as
PRIu16 can be used to detect the existence of
uint16_t with conditional compilation.
Related types:
uint16_tint16_tuint_least16_t int_least16_t uint_fast16_t int_fast16_t
| Property |
uint16_t |
int16_t |
|
|---|---|---|---|
| Width (bits) | 16 | ||
| Lowest value | 0 | −32768 | |
| Highest value | +65535 | +32767 | |
printf |
base 10 | "%"
PRIu16 |
"%"
PRId16 or "%"
PRIi16 |
| base 8 | "%"
PRIo16 |
||
| upper-case base 16 | "%"
PRIX16 |
||
| lower-case base 16 | "%"
PRIx16 |
||
scanf |
base 10 | "%"
SCNu16 |
"%"
SCNd16 |
| base 8 | "%"
SCNo16 |
||
| base 16 | "%"
SCNx16 |
||
| base 16, 8 or 10 by prefix | "%"
SCNi16 |
||