CKTIS / C
<limits.h> — integer type limits
The <limits.h> header exposes implementation-specific integer limits as macros, supporting portable range checks.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <limits.h><limits.h> defines constant macros, not functions. INT_MIN and INT_MAX bound int; UINT_MAX bounds unsigned int, whose minimum is zero. Do not assume 32-bit int.
CHAR_BIT counts bits per C byte, at least 8. CHAR_MIN reveals whether plain char is signed. C23 adds width macros such as INT_WIDTH, plus BITINT_MAXWIDTH for _BitInt(N).
MB_LEN_MAX bounds multibyte-character length across all supported locales. The example checks the limit before incrementing: signed arithmetic overflow has undefined behavior.
Examples
#include <limits.h>
#include <stdio.h>
int main(void)
{
int x = INT_MAX;
if (x < INT_MAX) {
++x;
} else {
puts("limit reached");
}
return 0;
}
Result
limit reached
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.