Solved

Array size

Posted on 1998-08-16
3
180 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

860 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