Incorporate diagnostic tests into your program. The assert()
macro is one convenient mechanism for interactive programs.
The assert
macro expands to a void expression:
Code Block |
---|
#include <assert.h> void assert(scalar expression); |
When it is executed, if expression
(which must have a scalar type) is false, the assert
macro writes information about the particular call that failed (including the text of the argument, the name of the source file, the source line number, and the name of the enclosing function) on the standard error stream in an implementation-defined format and calls the abort()
function.
...