www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/11/20:44:59

Message-Id: <199808120044.BAA26017@sable.ox.ac.uk>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: "George Foot" <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: Endlisnis <s257m AT unb DOT ca>
Date: Wed, 12 Aug 1998 01:43:36 +0000
MIME-Version: 1.0
Subject: Re: Arrays giving problem
Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk
CC: djgpp AT delorie DOT com

On 11 Aug 98 at 18:57, Endlisnis wrote:

> Anand Singh Bisen wrote:
> 
> > Hello
> >
> >     I have just started coding in DJGPP actually i have shifted from Pascal.
> > Somebody told me that we can make huge arrays up to the order of the RAM
> > available to the system but when i make a program with int ary[100000] the
> > program compiles and links properly but when i run it gives some huge
> > numbers with error messages. What might be the problem.
> 
> Try:
> int *ary = new int[100000];  //this uses 512K of RAM.

That's C++; the C version is to call `malloc', and check that it 
doesn't return NULL.

> It is addressed (somewhere) in the FAQ, and there is another way around it, but
> this is the easiest way.  The use of this variable is still identicle,
> int a = ary[999];

The use isn't quite identical; the sizeof operator will return
differently.  sizeof(ary) is now sizeof(int *), which is 4 with
djgpp.

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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