CKTIS / C
uint16_t — exactly 16-bit unsigned integer type
uint16_t from <stdint.h> names an optional unsigned integer type with exactly 16 bits and a range of 0–65535.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <stdint.h>
uint16_t value;uint16_t is a typedef name from <stdint.h>: an unsigned type with exactly 16 bits and no padding bits. Its range is 0–65535; UINT16_MAX specifies the maximum.
The type is optional: an implementation must provide it if it has a suitable integer type. When at least 16 bits suffice, choose uint_least16_t. Exact width does not determine byte order. In the example, casting to unsigned int matches the argument to %u.
Examples
#include <stdint.h>
#include <stdio.h>
#ifndef UINT16_MAX
#error uint16_t is required
#else
int main(void)
{
uint16_t value = UINT16_MAX;
printf("%u\n", (unsigned int)value);
return 0;
}
#endif
Result
65535
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.