Assertions are a programming technique where tests are added for conditions that cannot happen. The program kills itself when it enters such an impossible state, dumping a core file if it can.
The assert macro
evaluates the expression. If the expression is zero (false), the process is terminated, a diagnostic message is written to the standard error stream, and the abort() function is called, which terminates the program by raising the signal SIGABRT. Because most programmers use asserts for debugging purposes, you can compile them out of a production program by using the preprocessor flag -DNDEBUG. Be aware of side effects due to code called in the assert() macro. This could cause your program ...