#define MUX(a,b) a*b
MUX(10-5,10+5) = 10+5*10-5 = 10+50-5 = 55
I think MUX(10-5,10+5) = (10-5)*(10+5) = 75
, but it's wrong.
Why? Can anyone explain?
#define MUX(a,b) a*b
MUX(10-5,10+5) = 10+5*10-5 = 10+50-5 = 55
I think MUX(10-5,10+5) = (10-5)*(10+5) = 75
, but it's wrong.
Why? Can anyone explain?
It's because macro replacement is entirely textual. If you want parentheses for correct arithmetic, they must be in the replacement text.