www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/22/05:21:55

Date: Thu, 22 Mar 2001 15:36:54 +0530 (IST)
From: Mridul Muralidharan <ec97027 AT matrix DOT reccal DOT ernet DOT in>
To: danieleliasson AT chello DOT se
cc: Djgpp mailing list <djgpp AT delorie DOT com>
Subject: Re: Problem with int[][]
In-Reply-To: <oQgu6.512$I81.4799@nntp1.chello.se>
Message-ID: <Pine.LNX.4.04.10103221530060.969-100000@matrix.reccal.ernet.in>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019