Latest web development tutorials

C standard library - <assert.h>

Brief introduction

C standard library header filesassert.h providing macro called assert,which can be used to verify the assumptions made in the program, and the assumption is false output diagnostic messages.

Assert macro defined point to another macro NDEBUG,macroNDEBUGnot <assert.h> part. If you have defined as a macro name in reference NDEBUG <assert.h> source file, theassert macro is defined as follows:

#define assert(ignore) ((void)0)

Macro library

Listed below are the only functions defined in the header file assert.h:

序号函数 & 描述
1 void assert(int expression)
这实际上是一个宏,不是一个函数,可用于在 C 程序中添加诊断。