delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/25/18:37:16

From: "David" <nobody AT bogus DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <20000825130411 DOT 28570 DOT qmail AT web511 DOT mail DOT yahoo DOT com>
Subject: Re: Help again. Heh dont you just hate newbies? <grin>
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <9Nvp5.10310$Ez6.65369@news3.atl>
Date: Fri, 25 Aug 2000 10:54:14 -0400
NNTP-Posting-Host: 209.214.201.123
X-Trace: news3.atl 967215301 209.214.201.123 (Fri, 25 Aug 2000 10:55:01 EDT)
NNTP-Posting-Date: Fri, 25 Aug 2000 10:55:01 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Chris Amos <homie_dont_play_dat AT yahoo DOT com> wrote in message
news:20000825130411 DOT 28570 DOT qmail AT web511 DOT mail DOT yahoo DOT com...
> Im having problems again. Heh heh, well let me explain. I am trying to
> make a map array in memmory like so...
>
> int Map[500][500]; file://500x500 tile map
>
> DJGPP exits to rhide and displays an error message Exit code 255:
> 0x00ff or somthing like that. Ive tried lots of different things but
> none seem too work.
>
> int *Map[500][500];
>

You're trying to allocate 500 x 500 x 4 bytes = 976.5 as a static variable.
Possible problems are:

1. You don't have that much memory
2. The DJGPP system won't let you allocate that much memory statically

Try allocating the memory in your program:

int main(void)
{
   int *Map;

   Map = (int *) malloc(500 * 500 * sizeof(int));
   if (Map == NULL) {  // Important to check return of malloc
      printf("Could not allocate Map\n");
      exit(1);
   }

   Use(Map);
   free(Map);          // Important to free memory
}




- Raw text -


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