Hi, I've been using C++ for quite a while but recently I discovered this peculiar behaviour. The following code works as expected:
#define TWO 2;
int nVal = 3 + TWO;
cout<<nVal<<endl; // output is 5
...if on the other hand I place the literal integer after the '+' in the expression, the '+ 3' is ignored.
#define TWO 2;
int nVal = TWO + 3;
cout<<nVal<<endl; // output is 2, instead of 5
Is there any reason for this behaviour? I'm using Microsoft Visual C++ 2010 Express on Windows 7 32-bit.
Thanks,
Dean