Jump to content
  • Advertisement


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


Dynamic 3D Array

This topic is 6878 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

I think it goes something like this:

int ***map;

map = new int**[3];

for (int i = 0; i < 3; i++)
map[i] = new int*[100];

for (int j = 0; j < 100; j++)
map[i][j] = new int[100];


Then you can use it normaly.

You may also want to remember to delete it too :-)

I think a better way would be to write a special class to handle what you have in mind.

[This message has been edited by Bugdude (edited December 23, 1999).]

Share this post

Link to post
Share on other sites
Is there a way to create a 3D array at runtime? I tried what I thought would work, which is:

int *map;
map = new int[3][100][100];

but it didnt work...

so how would I go about doing this? or is there a better way to accomplish this?


Luis Sempe

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!