CKTIS / C
<assert.h> — runtime assertions
The <assert.h> header provides assert for checking program assumptions; NDEBUG disables these checks.
Version: C23; repository compiler flag, production runtime not attested
Syntax
#include <assert.h>
assert(expression);<assert.h> provides the assert macro. When its scalar test expression equals zero, it writes a diagnostic to stderr and calls abort(). The message format is implementation-defined.
Defining NDEBUG before including the header also removes argument evaluation. Therefore, do not put essential side effects in assertions or use them instead of input validation.
In C23, assert is a variadic macro, not a function; supply one scalar expression. The published C23 standard (ISO/IEC 9899:2024) specifies 202311L as the value of __STDC_VERSION_ASSERT_H__. static_assert is a keyword that checks conditions during translation, not a runtime assertion.
Examples
#include <assert.h>
#include <stdio.h>
int main(void)
{
int count = 3;
assert(count > 0);
printf("count = %d\n", count);
return 0;
}
Result
count = 3
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.