Hi... I'm working on a small, text-based game, compiling under Kubuntu 6.10 (Edgy Eft) with G++ 4.1.2. Up until I added this function (and its corresponding call in main.cpp), it would compile correctly. Could anybody tell me why I'm getting the error "functions.h:16 3: error: invalid conversion from ‘int (*)[1]’ to ‘int'"?
Code:
int initcreate() {
int initiative[(MAXUNITS-1)][1];
int unitcount = 0;
for (int i = 0; i < (BOARDX-1); i++) {
for (int j = 0; j < (BOARDY-1); j++) {
if (forces[i][j] != 0) {
initiative[unitcount][0] = i;
initiative[unitcount][1] = j;
unitcount++;
}
}
}
return initiative;
}
Comment