www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/16/12:26:17

Date: Thu, 16 Jul 1998 19:19:32 +0300
From: Alexander Bokovoy <bokovoy AT bspu DOT ac DOT by>
Reply-To: Alexander Bokovoy <bokovoy AT bspu DOT ac DOT by>
Organization: BSPU named after Maxim Tank
Message-ID: <13805.980716@bspu.unibel.by>
To: djgpp AT delorie DOT com
Subject: Re: problem setting my map array
References: <01bdb0cf$784be300$b4691ace AT ZZTiger DOT mho DOT net>
Mime-Version: 1.0

Hi Joel,

16.07.98, you wrote:

> I've declared my map array like this:
> int map[MAP_HEIGHT][MAP_WIDTH];
> And I'm trying to write to it like this:
>         map =
>         {
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,
> 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
> 1,1,
[skipped]
> 1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,
> 1,1
>         };
> But DJGPP gives me this:
> tile.cpp: In method `void Tile_Map::Initialize()':
> tile.cpp:14: parse error before `]'
> What am I doing wrong?
Brief: You're declared two dimensional array but tried to initialize
it with one dimensional data.
Solution:
 map = { {1,1,1,1,1,....,1,1}, /* First Line */
         {1,1,1,1,1,....,1,1}, /* Second Line */
         ....
         {1,1,1,1,1,....,1,1} /* Last Line */
       };


Regards,
Alexander Bokovoy, <bokovoy AT bspu DOT unibel DOT by>
--=== The Soft Age coming soon ===--



- Raw text -


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