Include: ,
Prototype: void assert (expression);
See also: abort, raise, signal
The assert routine prints a diagnostic message and calls the abort routine
if expression is false (0). The diagnostic message has the form
Assertion failed: expression, file filename, line linenumber
where filename is the name of the source file and linenumber is the line
number of the assertion that failed in the source file. No action is taken
if expression is true (nonzero).
----- C 4.0 Difference -----
In Version 4.0 of the Microsoft C Run-Time Library, assert doesn't display
expression in the diagnostic message.
The assert routine (implemented as a macro) is typically used to identify
program logic errors. The given expression should be chosen so that it
holds true only if the program is operating as intended. After a program
has been debugged, the special "no debug" identifier NDEBUG can be used to
remove assert calls from the program. If NDEBUG is defined (by any value)
with a /D command-line option or with a #define directive, the C
preprocessor removes all assert calls from the program source.
Return Value
None.