Sunday, April 7, 2013

How to check MACRO is defined or not in C

#warning is preprocessor directives to print messages in preprocessing.

#ifdef MAX_RES_720P
#warning "Macro is defined, Value of  Macro = " MAX_RES_720P
#else
#warning "Macro is not defined"
#endif

In above example,
If macro MAX_RES_720P  is defined, #warning will print "Macro is defined..."
Otherwise, it will print "Macro is not defined"

No comments:

Post a Comment