Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(int y = 0; y <= height; y++) // an iteration of this loop will move you down one row
- {
- for(int x = 0; x <= width; x++)
- {
- // an iteration of this loop will move you to the right one column.
- // This will go through an entire row before exiting the loop and giving y a chance to move down.
- newArray[x][y] = oldArray[x][y]; // takes the current xy-position in your 2D array and saves it to the new array
- // x increases by one
- }
- // y increases by one
- }
- /*
- your multi-dimensional array is like a coordinate system, and each point in the system holds data. like a color for a pixel at (x,y).
- x -->
- [][][][][][] y
- [][][][][][] |
- [][][][][][] |
- V
- If you save each item from a row into a new array, then move down and save each item in the row into the new array, and continue until you hit the bottom, then you will have moved through every element in the array.
- (0,0)(1,0)(2,0)(3,0)(4,0)(5,0)
- (0,1)(1,1)(2,1)(3,1)(4,1)(5,1)
- (0,2)(1,2)(2,2)(3,2)(4,2)(5,2)
- etc.
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement