Advertisement

3D arrays to 1D pointers & finding locations

Started by June 04, 2001 09:43 PM
0 comments, last by Vulcan 23 years, 8 months ago
I have a 3 dimensional array of locations of objects and would like to put it inot a pointer, but of course you cant do int*** myarray = new int[x][y][z]; but you have to do this int* myarray = new int[x*y*z]; how then do i access certain locations of the memory, like location [2][4][1]? You obviously cant do [2*4*1]. help! -Vulcan
nevermind i got it

array[x][y][z] = array[(x-1)<<3+(y-1)<<2+(z-1)]

This topic is closed to new replies.

Advertisement