Advertisement

Dynamic 3D Array

Started by December 23, 1999 02:36 AM
0 comments, last by VisualLR 25 years, 2 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


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