C++ Programming/Code/Standard C Library/Functions/assert

From Wikibooks, open books for an open world
Jump to navigation Jump to search


[edit | edit source]
#include <cassert>
assert( exp );

The assert() macro is used to test for errors. If exp evaluates to zero, assert() writes information to stderr and exits the program. If the macro NDEBUG is defined, the assert() macros will be ignored.

Related topics