• Advertisement

Archived

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

Question...

This topic is 5248 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''m wondering how to accurately convert a 2 dimensional array, to a one dimensional array. I know that they are basically the same thing, but for some reason everything I have tried has failed. I want to do this: Array = 2dArray; Something like this(?): for(x = 0; x<512; x++) { for(y = 0; y<512; y++) { 2dArray[x][y] = Array[don''t know what to put here] } }

Share this post


Link to post
Share on other sites
Advertisement
Try this:


for(x = 0; x<512; x++)
{
for(y = 0; y<512; y++)
{

//512 is the length of one horizontal line
2dArray[x][y] = Array[x+(y*512)]

}
}

EDIT: Make sure array is defined something like
int Array[512*512] so there are no overflows.


"Skepticism.... that great rot of the intellect." - V.H.
Bah, what does HE know?


Albekerky Software


[edited by - sliderag on October 8, 2003 5:37:42 PM]

Share this post


Link to post
Share on other sites

  • Advertisement