uint16_t --Unsigned 16bit integer type

"Uint16_t" is an unsigned 16-bit integer type. It can be used by including the " stdint.h" header. This is the type introduced in C99.

# Unsigned 16bit integer type
uint16_t

The maximum value of an integer that can be represented by an unsigned 16-bit integer type is "65535", and the minimum value is "0".

The maximum value is defined by the macro " UINT16_MAX".

uint16_t sample code

This is a sample code using uint16_t.

#include <stdio.h>
#include <stdint.h>

int main (void) {
  uint16_t num = 65535;
  
  printf("%u\n", num);
}

"%U" is used in the format specifier of printf function.

Output result.

65535

Associated Information