What is the regular way of claiming in C?

I use the NSAssert macro to validate Objective-C, and this is the usual way to do this. But it does not work in C. functions. What should I use for this?

+5
source share
3 answers

NSCAssert()(as well NSCAssert1()as ... to NSCAssert5())

+7
source
#include <assert.h>

...

assert(<expression>);

( link )

+11
source
void assert(int expression); 

If expression evaluates to 0 (false), then the expression, source code filename, 
and line number are sent to the standard error, and then calls the abort 
function. 

If the identifier NDEBUG ("no debug") is defined with #define NDEBUG then the 
macro assert does nothing.

:

assert(x != 0);

note: assert.h

+4

All Articles