highest range of array

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Mister X
New poster
Posts: 5
Joined: Sun Mar 04, 2007 6:08 pm

highest range of array

Post by Mister X »

plz tell me what are the highest ranges for different kinds of array to be taken in memory,
like for int, long, bool....and explain :roll:
Mister X
New poster
Posts: 5
Joined: Sun Mar 04, 2007 6:08 pm

Post by Mister X »

why don't anyone reply?:(
i wanted to know what is the highest size of the array(int,long,bool,char type) can be declared in c++?
plz reply...
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

C++ itself doesn't place any restrictions on maximum size of arrays.
It depends on your hardware's architecture, compiler, OS, amount of physically available memory...

At this online judge, default memory limit for programs is 32Mb.
That's 33554432 bytes. Divide this number by the size of array's element to get the maximum size of array you can have.
Mister X
New poster
Posts: 5
Joined: Sun Mar 04, 2007 6:08 pm

Post by Mister X »

thnx for your rply. suppose i am using visual c++ as compiler and my pc is 64bit and say i have enough available memory, then isn't there any limit?!!
any standard??
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Post by mf »

With 64-bits you're pretty much limited only by the amount of physically installed memory.

In fact, a 64-bit compiler should be able to compile programs with any array size, as long as total size of all arrays doesn't exceed about 2^64 bytes.
But you won't be able to load the program if you don't have enough memory.
Post Reply

Return to “C++”