www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/22/01:32:46

From: "Daniel Eliasson" <danieleliasson AT chello DOT se>
Newsgroups: alt.comp.lang.learn.c-c++,comp.os.msdos.djgpp
Subject: Problem with int[][]
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <oQgu6.512$I81.4799@nntp1.chello.se>
Date: Thu, 22 Mar 2001 06:20:04 GMT
NNTP-Posting-Host: 193.150.238.248
X-Complaints-To: abuse AT chello DOT se
X-Trace: nntp1.chello.se 985242004 193.150.238.248 (Thu, 22 Mar 2001 07:20:04 MET)
NNTP-Posting-Date: Thu, 22 Mar 2001 07:20:04 MET
Organization: chello broadband
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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