Mail Archives: djgpp/2001/03/22/05:21:55
hi,
the error mentioned is reported when u try something like this -
int map[GRIDSIZE][GRIDSIZE];
main(){
// A var map which is the one used in this local scope
int map;
// Rest of code
}
hence here u have a local variable of different type but same name
declared in a local scope.
check u'r code buddy :)
hope this helped u,
Mridul Muralidharan
S8 Electronics and Communication
Regional Engineering College
Calicut
India
------------------------------------------------------------------------------
If the code and the comments disagree, then both are probably wrong.
-- Norm Schryer
All generalizations are false, including this one.
-- Mark Twain
/earth is 98% full ... please delete anyone you can.
- fortune
On Thu, 22 Mar 2001, Daniel Eliasson wrote:
> I keep getting these messages when I use my array:
>
> player.cpp:55: invalid types `int[int]' for array subscript
> player.cpp:57: invalid types `int[int]' for array subscript
>
>
> The code looks like this:
>
> for(int i = 0; i < GRIDSIZE; i++)
> {
> for(int j = 0; j < GRIDSIZE; j++)
> {
> if(map[i][j] == GRID_PLAYER) // It's complaining about these
> {
> map[i][j] = GRID_EMPTY; // It's complaining about these
> }
> }
> }
>
> Does anyone know what's wrong? I define map like this:
> int map[GRIDSIZE][GRIDSIZE];
>
> (GRIDSIZE is a const int with the value of 128 (const int GRIDSIZE = 128;))
>
> Thanks in advance,
> Daniel Eliasson
>
>
- Raw text -