• Advertisement

Archived

This topic is now archived and is closed to further replies.

Dynamic 3D array allocation

This topic is 5907 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

using new & delete, how do I dynamically allocate & deallocate a 3 dimensional array? -Vulcan

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Where did that post go, dude? I need to know how to pass a pointer to a multi-dimensional array to a function.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The same way you pass the pointer of anything to a function? Use the & operator.

Share this post


Link to post
Share on other sites

  • Advertisement