Used for implementing run-time diagnostics in programs.
#include <assert.h> void assert (int expression);
The assert function writes a message in the following form:
Assertion failed: expression, file aaa, line nnn
If expression is true (that is, it evaluates to nonzero) or if the signal SIGABRT is being ignored, assert returns no value.
Compiling with the CC command qualifier /DEFINE=NDEBUG or with the preprocessor directive #define NDEBUG ahead of the #include assert statement causes the assert function to have no effect.
#include <stdio.h>
#include <assert.h>
main()
{
printf("Only this and the assert\n");
assert( 1==2 ); /* expression is FALSE */
/* abort should be called so the printf will not happen. */
printf("FAIL abort did not execute");
}