C/Development/Assert

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

Demonstrating assertions

<source lang="cpp">

  1. include <stdio.h>
  2. undef NDEBUG
  3. include <assert.h>

void main() {

 int x = 0;
 int y = 5;
 for(x = 0 ; x < 20 ; x++)
 {
   printf("\nx = %d   y = %d", x, y);
   assert(x<y);
 }

}


      </source>