注册 登录
编程论坛 新人交流区

求助一个二维数组赋值的问题

qiqirainy 发布于 2007-10-10 00:16, 664 次点击
我GOOGLE了很多论坛...找不到问题所在啊...所以只好来求助了...谢谢大家了

const int MAXNODES=23;
const int PREFIX=100;
int TRAFFIC[23][100];
TRAFFIC[1][1]=10, TRAFFIC[2][2]=20, TRAFFIC[3][3]=30;


因为我的每维数量太大...所以只好选有值的那些来赋值...但是这个方法老有奇怪的错误存在:
error C2501:'TRAFFIC' : missing storage-class or type specifiers
error C2369: 'TRAFFIC' : redefinition; different subscripts
see declaration of 'TRAFFIC'

error C2440: 'initializing' : cannot convert from 'const int' to 'int [1][1]'
There are no conversions to array types, although there are conversions to references or pointers to arrays


There are no conversions to array types, although there are conversions to references or pointers to arrays


其他的也都是类似的错误

谢谢大家了....在线等着嘞
4 回复
#2
qiqirainy2007-10-10 00:27
没人来帮忙吗?
#3
succubus2007-10-10 01:14

每条赋值语句一分号结尾试试
int TRAFFIC[23][100] = { 0 };
TRAFFIC[1][1]=10;
TRAFFIC[2][2]=20;
TRAFFIC[3][3]=30;
...
这样应该就ok了

#4
qiqirainy2007-10-10 17:59
谢谢楼上!
#5
kevinlind2007-10-11 23:09
嗯,的确不该用逗号
1