CKTIS / C
unsigned int — unsigned integers
unsigned int stores values from 0 to UINT_MAX. Arithmetic in this type wraps rather than reporting an out-of-range result.
Version: C23; repository compiler flag, production runtime not attested
Syntax
unsigned int name = 0u;unsigned int, also spelled unsigned, is a standard unsigned integer type. Its range is 0 through UINT_MAX from <limits.h>. The guaranteed maximum is at least 65535; do not assume a 32-bit width.
Arithmetic in unsigned int operates modulo the mathematical value UINT_MAX + 1. Adding 1u to UINT_MAX produces 0. This wrapping is defined, but can cause program logic errors.
The example demonstrates this without assuming a particular type width. printf uses %u for unsigned int. The u suffix in 1u denotes an unsigned constant.
Examples
#include <limits.h>
#include <stdio.h>
int main(void)
{
unsigned int value = UINT_MAX;
value += 1u;
printf("%u\n", value);
return 0;
}
Result
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.