Connecting Tech Pros Worldwide Forums | Help | Site Map

ARRAY SIZE TOO LARGE

shreesh
Guest
 
Posts: n/a
#1: Sep 1 '06
I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.


Ian Collins
Guest
 
Posts: n/a
#2: Sep 1 '06

re: ARRAY SIZE TOO LARGE


shreesh wrote:
Quote:
I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.
>
Please don't shout.

Array of what and in what context? If you hit an implementation limit
for automatic variables, try dynamic allocation.

--
Ian Collins.
shreesh
Guest
 
Posts: n/a
#3: Sep 1 '06

re: ARRAY SIZE TOO LARGE


well. my array context is as follows.

struct authors
{
char name[50];
int uniq_id;
}node[10000];

i am getting an array out of size error.
I tried using the huge decleration as follows.

struct authors
{
char name[50];
int uniq_id;
};
struct authors huge node[10000];

But then i a m having problems in accesing the structure elements.
Ex: printf("%s",node[0].name)
prints: ( null )
So am still stuck with the size limitation.

Is my way of accessing the individual structure elements correct??







Ian Collins wrote:
Quote:
shreesh wrote:
Quote:
I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.
Please don't shout.
>
Array of what and in what context? If you hit an implementation limit
for automatic variables, try dynamic allocation.
>
--
Ian Collins.
shreesh
Guest
 
Posts: n/a
#4: Sep 1 '06

re: ARRAY SIZE TOO LARGE



shreesh wrote:
Quote:
well. my array context is as follows.
>
struct authors
{
char name[50];
int uniq_id;
}node[10000];
>
i am getting an array out of size error.
I tried using the huge decleration as follows.
>
struct authors
{
char name[50];
int uniq_id;
};
struct authors huge node[10000];
>
But then i a m having problems in accesing the structure elements.
Ex: printf("%s",node[0].name)
prints: ( null )
So am still stuck with the size limitation.
>
Is my way of accessing the individual structure elements correct??
>
>
>
>
>
>
>
Ian Collins wrote:
Quote:
shreesh wrote:
Quote:
I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.
>
Please don't shout.

Array of what and in what context? If you hit an implementation limit
for automatic variables, try dynamic allocation.

--
Ian Collins.
shreesh
Guest
 
Posts: n/a
#5: Sep 1 '06

re: ARRAY SIZE TOO LARGE


well. my array context is as follows.

struct authors
{
char name[50];
int uniq_id;

}node[10000];

i am getting an array out of size error.
I tried using the huge decleration as follows.

struct authors
{
char name[50];
int uniq_id;
};

struct authors huge node[10000];

But then i a m having problems in accesing the structure elements.
Ex: printf("%s",node[0].name)
prints: ( null )
So am still stuck with the size limitation.

Is my way of accessing the individual structure elements correct??

jaysome
Guest
 
Posts: n/a
#6: Sep 1 '06

re: ARRAY SIZE TOO LARGE


On 31 Aug 2006 23:10:13 -0700, "shreesh" <shreeshsikaria@gmail.com>
wrote:
Quote:
>well. my array context is as follows.
>
>struct authors
>{
char name[50];
int uniq_id;
>
>}node[10000];
>
>i am getting an array out of size error.
>I tried using the huge decleration as follows.
>
>struct authors
>{
char name[50];
int uniq_id;
>};
>
>struct authors huge node[10000];
>
>But then i a m having problems in accesing the structure elements.
>Ex: printf("%s",node[0].name)
prints: ( null )
>So am still stuck with the size limitation.
>
>Is my way of accessing the individual structure elements correct??
Yes.

Try posting a complete example of your code that compiles, links, and
runs. Someone may be able to help you then, but be advised that "huge"
is non-standard C.

--
jay
Igmar Palsenberg
Guest
 
Posts: n/a
#7: Sep 1 '06

re: ARRAY SIZE TOO LARGE


shreesh wrote:
Quote:
I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.
Use a decent compiler, or switch to heap allocated memory.



Igmar

CBFalconer
Guest
 
Posts: n/a
#8: Sep 1 '06

re: ARRAY SIZE TOO LARGE


Igmar Palsenberg wrote:
Quote:
shreesh wrote:
>
Quote:
>I want to use an array of size greater than ARRAY[256][256] but
>am getting an array size too large error.
>I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
>How can i get around this simple but irritating problem.
>
Use a decent compiler, or switch to heap allocated memory.
Don't be silly. There is no guarantee of over 32767 bytes
available in C90, nor of over 65535 available in C99.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html


Ancient_Hacker
Guest
 
Posts: n/a
#9: Sep 1 '06

re: ARRAY SIZE TOO LARGE



shreesh wrote:
Quote:
I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.
BC 3.1 is probably a 16-bit address compiler, which limits arrays to
65536 bytes. And that's 256 x 256.

It's probably high time you move to a 32 or 64-bit compiler. BC 5.5 is
free and available from www.borland.com (if you can figure out their
unintuitive web site and links).

Even better, you can download Visual C from the Microsoft site.

osmium
Guest
 
Posts: n/a
#10: Sep 1 '06

re: ARRAY SIZE TOO LARGE


"shreesh" writes:
Quote:
>I want to use an array of size greater than ARRAY[256][256] but am
getting an array size too large error.
I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
How can i get around this simple but irritating problem.
I see two possible ways to proceed. Type <huge msdosinto Google *groups*,
and see where it leads.

Get a new compiler if you don't need the ms-dos stuff. All good things
eventually end and it gets harder and harder to do things the old way. To
get up and running with the Dev-C download is fairly easy. Type in an
explicit file extender of .c when you assign a name to your source file and
the program will be compiled as a C program. I've never had much luck with
the debugger and the documentation is sparse, but other than that, no
problems.

http://www.bloodshed.net/dev/devcpp.html.


Keith Thompson
Guest
 
Posts: n/a
#11: Sep 1 '06

re: ARRAY SIZE TOO LARGE


CBFalconer <cbfalconer@yahoo.comwrites:
Quote:
Igmar Palsenberg wrote:
Quote:
>shreesh wrote:
Quote:
>>I want to use an array of size greater than ARRAY[256][256] but
>>am getting an array size too large error.
>>I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
>>How can i get around this simple but irritating problem.
>>
>Use a decent compiler, or switch to heap allocated memory.
>
Don't be silly. There is no guarantee of over 32767 bytes
available in C90, nor of over 65535 available in C99.
Of course there's no guarantee, but compilers are *permitted* to
support objects larger than the limits specified in the standard(s).
They're also permitted to support larger objects in some contexts than
in others (e.g., depending on storage duration).

Switching to a different compiler, or using malloc() rather than a
declared object, is a perfectly sensible thing to try, even though the
standard doesn't happen to guarantee that it will help.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Sjouke Burry
Guest
 
Posts: n/a
#12: Sep 1 '06

re: ARRAY SIZE TOO LARGE


Igmar Palsenberg wrote:
Quote:
shreesh wrote:
>
Quote:
>I want to use an array of size greater than ARRAY[256][256] but am
>getting an array size too large error.
>I am using a BC 3.1 on msdos ver 5.1.2600 on XP.
>How can i get around this simple but irritating problem.
>
>
Use a decent compiler, or switch to heap allocated memory.
>
>
>
Igmar
>
On my compilers, declaring it static cures your problem.
An astro prog of mine uses a ~40 megabyte array this way.
Closed Thread


Similar C / C++ bytes