Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

The <stdint.h> header

The <stdint.h> header provides integer types with specified widths and macros for their limits and constants.

Version: C23; repository compiler flag, production runtime not attested

Syntax

#include <stdint.h>

<stdint.h> lets you select types by width. Optional intN_t and uintN_t have exactly N bits, without padding bits.

int_leastN_t and uint_leastN_t minimize size for a width of at least N; int_fastN_t and uint_fastN_t favor usually fast arithmetic. Both families are required for N equal to 8, 16, 32, 64.

_MIN/_MAX macros specify limits; C23 provides _WIDTH. UINT16_C corresponds to uint_least16_t, not necessarily uint16_t.

Examples

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

int main(void)
{
    uint_least16_t count = UINT16_C(1000);
    printf("%u\n", (unsigned int)count);
    return 0;
}

Result

1000

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources