you are correct kryptonite but if you look at the example, x is just 2.0 so my there wont be any confusion. However, if the programmer was lame enough to add #define x 2+4 to his code, then he will not get the answer he had expected. In the tutorial i explained the importance of parenthesis. I didnt need to do #define CUBE(x) ((x)*(x)*(x)) because i was just multiplying 2.0 with itself 3 times, but like you said, if i wanted to multiply 2+4 together 3 times, i should have added parenthesis.Code:#include <iostream.h> #define CUBE(x) (x*x*x) int main (void) { double x; x=2; cout << x << " cubed "; cout << "is " << CUBE(x); }![]()





Reply With Quote