468,504 Members | 1,956 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,504 developers. It's quick & easy.

ARRAY SIZE TOO LARGE

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.

Sep 1 '06 #1
11 10269
shreesh wrote:
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.
Sep 1 '06 #2
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:
shreesh wrote:
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.
Sep 1 '06 #3

shreesh wrote:
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:
shreesh wrote:
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.
Sep 1 '06 #4
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??

Sep 1 '06 #5
On 31 Aug 2006 23:10:13 -0700, "shreesh" <sh************@gmail.com>
wrote:
>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
Sep 1 '06 #6
shreesh wrote:
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

Sep 1 '06 #7
Igmar Palsenberg wrote:
shreesh wrote:
>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
Sep 1 '06 #8

shreesh wrote:
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.

Sep 1 '06 #9
"shreesh" writes:
>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.
Sep 1 '06 #10
CBFalconer <cb********@yahoo.comwrites:
Igmar Palsenberg wrote:
>shreesh wrote:
>>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) ks***@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.
Sep 1 '06 #11
Igmar Palsenberg wrote:
shreesh wrote:
>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.
Sep 1 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Yaroslav Bulatov | last post: by
2 posts views Thread by Developwebsites | last post: by
29 posts views Thread by shmartonak | last post: by
7 posts views Thread by ultr | last post: by
2 posts views Thread by kaczmar2 | last post: by
2 posts views Thread by ctj951 | last post: by
5 posts views Thread by =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post: by
3 posts views Thread by =?Utf-8?B?SXpvcmljaA==?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.