🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Dynamic 3D Array

Started by
0 comments, last by VisualLR 24 years, 6 months ago
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?

thanks!

------------------
Luis Sempe
visuallr@guate.net
http://www.geocities.com/SiliconValley/6276


Advertisement
I think it goes something like this:
int ***map;map = new int**[3];for (int i = 0; i < 3; i++){	map = new int*[100];<P>	for (int j = 0; j < 100; j++)<BR>		map[j] = new int[100];<P>}<BR></pre><BR>Then you can use it normaly. <P>You may also want to remember to delete it too :-)<P>I think a better way would be to write a special class to handle what you have in mind.<p>[This message has been edited by Bugdude (edited December 23, 1999).]

This topic is closed to new replies.

Advertisement