Hello, I have this project I'm working on. The following conditions apply
- In this project I need to create one huge array (hopefully I will be able to create one as big as ~7.13e+17, but this target is still up ahead.)
- Each cell inside the array can contain one of the three values: 0,1,2
- I'm using C++ as my language.
I tried using the normal dynamic array command
int * p;
int i;
i=[size]; //This is calculated somewhere else.
p= new (nothrow) int[i];
But as far as I understand, this array makes an array with a possible maximum size of the maximum size of int. If I change my code and use the following code
long long * p;
long long i;
i=[size]; //This is calculated somewhere else.
p= new (nothrow) long long [i];
Then each cell in the array is of type "long long" making the array very memory heavy. Is there any way to create an array using long long to determine the number of cells in the array and have every cell of size int?
Thanks a lot, Uriel.
EDIT: for further information.
- This problem is mainly theoretical, it is part of my Master's thesis. I would still like this program to work as best as it can.
- My current step is to make this work for an array with 2.56e+09 items, quick calculation shows we are talking about an array that's at least 0.6 Gigabytes, something my system should be able to cope with. Yet I cannot achieve this goal with my current coding solution even though the amount of space required is really at 4.5GB.