delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/03/10:17:42

From: "Matthew Bennett" <Bennett AT btinternet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Simple newbie problem - arrays
Date: 3 May 1997 10:05:13 GMT
Organization: Visit my web page at http://www.btinternet.com/~bennett/matthew.html
Lines: 29
Message-ID: <01bc57a9$47894800$0b3e63c3@8652hvt73761>
NNTP-Posting-Host: host5-99-62-11.btinternet.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I'm new to djgpp, and even C/C++.  I'm not however new to programming ;)
Anyway, one of the cool things about djgpp is it's protected mode stuff,
allowing you to easily use extended memory.
I decided to try this out with a simple array. Here's my program:

#include <stdio.h>     // I know I don't need this, but hey...

int main(void)
{
int q[100][100][100];
q[80][80][80] = 44;
printf("%d", q[80][80][80]);
return 0;
}

This array should only use about a meg, and so it should have plenty of
space with extended mem etc.
However, when I run it the program quits with an error - presumably because
it ran out of memory.  It works fine for small arrays though.

How can I use large arrays like this - there must be a way in djgpp to
store them using extended memory.

Any suggestions?

Thanks, 
Matthew

- Raw text -


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