cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/28/14:00:28

From: "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: large arrays -- newbie question
Date: Mon, 28 Jun 1999 13:26:21 -0400
Organization: Nortel Networks
Lines: 23
Message-ID: <3777B03C.F70D8D73@americasm01.nt.com>
References: <19990628120046 DOT 27702 DOT 00002114 AT ngol08 DOT aol DOT com> <7l8972$ose AT dfw-ixnews5 DOT ix DOT netcom DOT com>
NNTP-Posting-Host: bmerhc00.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.6 [en] (X11; I; HP-UX B.10.20 9000/712)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Marp wrote:

> > char large_ish_matrix [720] [486]

> Why not just try it and find out :) I don't see any reason why you shouldn't
> be able to use an array this large. However, whenever I need more memory
> than just a few bytes, I use a pointer and allocate the memory from the heap
> instead.
> In C++ that would mean using the new and delete operators or in C the
> functions malloc and free. You should be able to use an array that large if
> you prefer to do it this way.

    The only problem he might have is, if he declares it local, he might blow
the stack.  Also, if he declares it global, funny things can happen (I've had
problems declaring large global arrays).  Either way, it's best to use
malloc/new to allocate big chunks of memory (more than a few k).  Also, you may
find it difficult to make a mutidimensional array using new/malloc.

--
     -Rolf Campbell (39)3-6318



- Raw text -


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