I have made the following #defines
#define GOLD 1;
#define SILVER 2;
later in my program I set up some variables
int source, target;
They are then set to the values:
source = GOLD;
target = SILVER;
I now want to compare in an if statement:
if(source == GOLD) {...}
But the compiler complains Expected ')' before ';' token. If I change the line to
if(source == 1) {...}
There is no problem with the compiler or the behavior. How do I reference the #define in the if statement to make myself clear to the compiler?
Because you have an errant ;
after the #define GOLD 1
and #define SILVER 2
. Remove them, your problem will go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With