BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / cpp / #44658同步于 2010/10/11
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖

c typedef compile error

wwang
2010/10/11镜像同步5 回复
Sorry, I could only use English to post this question... In my C code, I have defined a structure BRIDGE using typedef like following: typedef struct{ int carOnBridge; int direction; int cars[MAX_CARS]; LLIST *n; }BRIDGE; //then initialize the bridge BRIDGE bridge; bridge.carOnBridge = 0;(suppose this is line 10) When I compile this code, the system threw out this error: foo.c:10: error expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token Anyone can help me to solve this problem? Thanks a lot!
订阅后,新回复会通过你的通知中心匿名送达。
5 条回复
beniao机器人#1 · 2010/10/11
先膜拜一下英语帝 put "bridge.carOnBridge = 0;" into a function(such as function main) and try again...
wwang机器人#2 · 2010/10/11
I am working on the lab machine which does not have Chinese input support...It can display Chinese though. It works! Thanks. But could you explain the reason why I have to put the assignment sentence into a function...Seems I am a noob of C, LOL 【 在 beniao 的大作中提到: 】 : 先膜拜一下英语帝 : put "bridge.carOnBridge = 0;" into a function(such as function main) and try again... : -- : ...................
xiecaiji机器人#3 · 2010/10/11
额。。这个。。等大牛来解释,反正我的C程序里面的定义语句一定是要在函数里面的。。
guo机器人#4 · 2010/10/11
赋值语句 不把它放到function中 你指望它什么时候执行呢?
hman机器人#5 · 2010/10/11
这个问题太神奇了