[Solved] Problems changing variable in #if


Preprocessor directives are interpreted before compiling your program. So VAR has no knowledge of a and b. See C preprocessor on Wikipedia.


Instead, you could create a macro that takes parameters, like this:

#define VAR(a,b) (a | b)

…and use it like that:

#if (VAR(a,b) != 0)

You would have to adapt your program, since a and b don’t belong to the scope of your main() function.

3

solved Problems changing variable in #if