Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Array size

Posted on 1998-08-16
3
Medium Priority
?
197 Views
Last Modified: 2010-04-01
Hello friends,
                     I'm fixing my array size to 1 billion.Will the program works well?.
Is there is a maximum fixed size for the array size to be set?.
Thanxs in advance.
0
Comment
Question by:66
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
willemnel earned 0 total points
ID: 1170451
You can basically set your array size to any size you want, but you will be limited by your computer's memory. You must also remember that different types of arrays use different amounts of memory e.g. "char" uses 1 byte per element, "int" uses (depending on the compiler) 4 bytes etc. That means that if you want to declare an array of "char" with 1 billion (1000 000 000) elements, you'll need roughly 1000 MB of ram. Unless you got one serious PC, I don't think your program will work!
0
 
LVL 85

Expert Comment

by:ozo
ID: 1170452
It might still work if you have 1000 MB of swap space, but it could be slow.
If your addresses are limited to 32 bits, you would have another limit around 4 billion.
0
 
LVL 1

Expert Comment

by:willemnel
ID: 1170453
Ozo's right, of course. I was assuming that your talking about about "normal" circumstances where disk swapping is not used.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question