Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Array size

Posted on 1998-08-16
3
Medium Priority
?
189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 84

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

670 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