【发布时间】:2010-12-22 05:02:46
【问题描述】:
我做了以下#defines
#define GOLD 1;
#define SILVER 2;
稍后在我的程序中我设置了一些变量
int source, target;
然后将它们设置为值:
source = GOLD;
target = SILVER;
我现在想在 if 语句中进行比较:
if(source == GOLD) {...}
但是编译器在 ';' 之前抱怨 Expected ')'令牌。如果我将行更改为
if(source == 1) {...}
编译器或行为没有问题。如何在 if 语句中引用 #define 以使编译器清楚自己?
【问题讨论】:
标签: objective-c c syntax