c - What does this define mean? #define ASSERT(exp) -
i see code in c program don't understand.
#define assert(exp) if(!(exp)){putstr("err\n");}
please explain , show me how use it. thank you!
you should read preprocessor directives in c.
here creating macro, gets replaced during compile time value used define macro with.
for eg:
we can use
assert(<some condition or expression>)
through out code instead of
if(<some condition or expression>) { putstr("err\n"); }
during compile time, compiler replaces assert actual condition.
Comments
Post a Comment