I have a 2d 9x9 int array as follows

000000000
000000000
000000000
000000000
000000000
000000000
000000000
000000000
000000000

but im trying to extract every box of 3x3 into an array using only a nested for loop, i.e.

----------------
|000|000|000|
|000|000|000|
|000|000|000|
----------------
|000|000|000|
|000|000|000|
|000|000|000|
----------------
|000|000|000|
|000|000|000|
|000|000|000|
----------------

so each box of 3x3 goes into a 1d array and then some calculations are done with that array and then get the next box of 3x3 and put it in that same array, the order for each box to be extracted is left to right. please any help or ideas would be appreciated.

thank you

Member Avatar for iamthwee

First of all write down the index positions of the indexes on paper. Once you have found a common factor use it to create a more generic extraction algorithm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.