How to use assert function in C language
This article Xiaobian for you to introduce in detail "how to use the assert function in the c language", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use the assert function in the c language" can help you solve your doubts.
1. Use assert to check the validity of the parameters passed at the beginning of the function.
2. Each assert tests only one condition, because when multiple conditions are tested at the same time, if the assertion fails, it is impossible to intuitively judge which condition fails.
Example
Int resetBufferSize (int nNewSize) {/ / function: change buffer size, / / Parameter: new length of nNewSize buffer / / return value: current length of buffer / / description: keep the original information content unchanged nNewSize= 0); assert (nNewSize)