Message-Id: <199808120044.BAA26017@sable.ox.ac.uk> Comments: Authenticated sender is From: "George Foot" To: Endlisnis Date: Wed, 12 Aug 1998 01:43:36 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Arrays giving problem Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk CC: djgpp AT delorie DOT com Precedence: bulk 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