CKTIS / C
uint8_t — unsigned 8-bit integer type
uint8_t from <stdint.h> stores values 0–255 in exactly 8 bits. Availability of this type depends on the implementation.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <stdint.h>
uint8_t name = value;uint8_t is a typedef name declared in <stdint.h>, not a keyword. It denotes an unsigned integer type: exactly 8 bits, no padding bits, range 0–255.
The type is optional; UINT8_MAX signals its availability. When at least 8 bits suffice, use the required uint_least8_t.
Arithmetic undergoes integer promotions: value + 1 is evaluated as int. Converting the result 256 to uint8_t yields 0, modulo 256. The example prints numerically using %u after conversion to unsigned int.
Examples
#include <stdint.h>
#include <stdio.h>
#ifndef UINT8_MAX
#error "uint8_t is required"
#else
int main(void)
{
uint8_t value = 255;
value = (uint8_t)(value + 1);
printf("%u\n", (unsigned int)value);
return 0;
}
#endifResult
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.