CKTIS / C
unsigned — unsigned integer types
The unsigned keyword specifies an unsigned integer type. Used alone, unsigned means unsigned int.
Version: C23; repository compiler flag, production runtime not attested
Syntax
unsigned [int] name;
unsigned char name;
unsigned short [int] name;
unsigned long [int] name;
unsigned long long [int] name;
unsigned _BitInt(N) name;unsigned specifies an unsigned integer type: unsigned char, unsigned short, unsigned int, unsigned long, unsigned long long, or, in C23, unsigned _BitInt(N). In unsigned _BitInt(N), N must be an integer constant expression that satisfies N >= 1 and N <= BITINT_MAXWIDTH, where BITINT_MAXWIDTH is the implementation's limit. Alone, unsigned means unsigned int. It cannot modify floating-point types.
The range is 0 through 2^N − 1, where N counts value bits. Arithmetic with an unsigned result type operates modulo 2^N. Width depends on the type and implementation; do not assume 32 bits. Promotions and conversions affect the computation type: mixing signed and unsigned types requires care.
Examples
#include <limits.h>
#include <stdio.h>
int main(void)
{
unsigned 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.