Mail Archives: djgpp/1998/08/11/20:44:59
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 -