Once again a Pointer

Hi,
I need 3 dimensional array but with this(code given below) format,
This is for 2 dimensional.
1
2
3
4
5
6
double **PDB;
double PDB = new double*[N]; // if N is rows 
for (int i = 0; i < N; ++i )
{
   PDB[i] = new double[M];
}

is it possible to define
like this
 
double ***PDB

İf it is possible how do we delete?
Normally when you start getting lots of dimensions you may want to rethink your design as it consumes a lot of memory.

Yes you can declare it as above for three dimensions, you just need to allocate it in similar manner as before.

Alternatively you allocate one block of memory and place pointers into it, that way it is easy to free and which is - depending on OS - often faster to allocate.

Topic archived. No new replies allowed.