Showing posts with label Multi-Dimensional Arrays. Show all posts
Showing posts with label Multi-Dimensional Arrays. Show all posts

Wednesday, January 21, 2015

Multi-Dimensional Arrays



The arrays you have been using so far have only held one column of data. But you can set up an array to hold more than one column. These are called multi-dimensional arrays. As an example, think of a spreadsheet with rows and columns. If you have 6 rows and 5 columns then your spreadsheet can hold 30 numbers. It might look like this:
A representation of a 2-dimensional array
A multi dimensional array is one that can hold all the values above. You set them up like this:
int[ ][ ] aryNumbers = new int[6][5];