Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C

uint32_t — exactly 32-bit unsigned integer type

uint32_t from <stdint.h> is an optional unsigned integer type with exactly 32 bits and no padding bits.

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

Syntax

#include <stdint.h>
uint32_t name;

uint32_t is a type name declared through typedef in <stdint.h>. It stores values from 0 to 4294967295; UINT32_MAX specifies its maximum.

The type is optional: an implementation must provide it if it has a suitable integer type without padding bits. When at least 32 bits suffice, consider uint_least32_t.

For printing, use PRIu32 from <inttypes.h> rather than assuming compatibility with %u. Exact width specifies neither byte order nor sizeof(uint32_t) == 4: a C byte need not contain 8 bits.

Examples

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

#ifndef UINT32_MAX
#error "uint32_t is required"
#else
int main(void)
{
    uint32_t value = UINT32_MAX;
    printf("%" PRIu32 "\n", value);
    value = 0;
    printf("%" PRIu32 "\n", value);
    return 0;
}
#endif

Result

4294967295
0

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