Newsgroups: alt.comp.lang.learn.c-c++,comp.os.msdos.djgpp Subject: Re: Problem with int[][] From: xnews DOT public DOT home AT bogus DOT rtij DOT nl (Martijn Lievaart) References: Organization: TINC Message-ID: User-Agent: Xnews/4.01.30 X-Memorial: To Herbs, where ever you are Date: 22 Mar 2001 16:51:32 GMT Lines: 35 NNTP-Posting-Host: 212.64.34.251 X-Trace: 985279892 dreader2.news.xs4all.nl 151 martijnl/212.64.34.251 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Daniel Eliasson" wrote in : >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;)) > map is a reserved identifier (in namespace std, but your compiler may not support that yet). Try renaming map to something else, and see if the problem goes away. HTH, M4