ARRAY SIZE TOO LARGE

S

shreesh

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

Ian Collins

shreesh said:
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.
 
S

shreesh

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 said:
shreesh said:
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.
 
S

shreesh

shreesh said:
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 said:
shreesh said:
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.
 
S

shreesh

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??
 
J

jaysome

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.
 
I

Igmar Palsenberg

shreesh said:
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
 
C

CBFalconer

Igmar said:
shreesh said:
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:
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
 
A

Ancient_Hacker

shreesh said:
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.
 
O

osmium

shreesh said:
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 msdos> into 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.
 
K

Keith Thompson

CBFalconer said:
Igmar said:
shreesh said:
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.
 
S

Sjouke Burry

Igmar said:
shreesh said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top