First of all realize how many elements you are storing, which is 115x4x114x114=5 978 160. Each element is a double, which is usually 64 bits (if I remember correctly) so 5 978 160x64=382 602 240 which is 382 megabits. Though this is well within the bounds of modern RAM, do be aware that you are storing quite a lot of data. Next you can use one of three techniques:
Technique 1: Real dynamically allocated multi-dimensional arrays:
This is a tricky one, but basically what you do is you realize that each array is a pointer, your array has 4 dimensions (it is an array of arrays of arrays of arrays of doubles) as such your new array is going to need 4 asterisks! Then you loop through each one useng the new operator to allocate your memory, like so:
double ****array;
//the following loops may be in reverse order, I cannot remember if you do 115-4-114-114 or 114-114-4-115
array=new double***[115];
for (int i=0; i<115; ++i)
{
array[i]=new double**[4];
for (int ii=0; ii<4; ++ii)
{
array[i][ii]=new double*[114];
for (int iii=0; iii<114; ++iii)
array[i][ii][iii]=new double[114];
}
}
and now you can use array just as if it were as posted above.
Technique 2: Real multi-dimensional vector:
This is a bit less tricky, but do note that > > has a space between the symbols! Basically you make a vector of vectors of vectors of vectors of doubles.
vector<vector<vector<vector<double> > > > array;
Technique 3: Fake multi-dimensional vector + …