c - How to use the following preprocessor statement -


#define is_this_correct(x) if(x){} 

i have preprocessor statement defined in project. trying understand how use function.

#define is_this_correct(x) if(x){} 

it can used check if x (any value) not 0 or not empty string etc. can following

is_this_correct("hello") else puts("the string empty"); 

you'd better surround x pair of braces more safety:

#define is_this_correct(x) if((x)){} 

i suggest rename preprocessor statement it_is_correct or is_correct more readability.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -