C Tutorial/assert.h/assert

Материал из C\C++ эксперт
Перейти к: навигация, поиск

assert

Item Value Header file assert.h Declaration void assert(int exp); Function writes error information to stderr and then aborts program execution if the expression exp evaluates to zero.

Define NDEBUG to ignore the assert() macros.


<source lang="cpp">#include <assert.h>

 int main(void){
   assert(1==2);
 }</source>