Dynamic 3D array allocation

Started by
2 comments, last by Vulcan 22 years, 5 months ago
using new & delete, how do I dynamically allocate & deallocate a 3 dimensional array? -Vulcan
Advertisement
Triple pointer, allocate outermost array (array of double pointers) and so on successively for each ''layer'' until you have allocated a linear array (after which there is nothing to do except initialize and use).

There was a recent thread on 2D array allocation, and a post there gave a description of how the technique was extensible to n-dimensions. I suggest you peruse it.
Where did that post go, dude? I need to know how to pass a pointer to a multi-dimensional array to a function.
The same way you pass the pointer of anything to a function? Use the & operator.

This topic is closed to new replies.

Advertisement