I wouldn't use multidimensional arrays, but they're straightforward.
Let's say you want to make a game board. You could possibly use multidimensional arrays to represent it. This is how a multidimensional array looks:
int board[5][5];
All it is is an array of arrays.
You can theoretically make an array of any dimension, the one shown above was a 2D array.
As you move up you dimensions, you consume more and more memory. So be careful.
This is how you'd set the game board.
1 2 3 4 5 6
|
int board[5][5] =
{{1, 0, 1, 0, 1},
{0, 1, 0, 1, 0},
{1, 0, 1, 0, 1},
{0, 1, 0, 1, 0},
{1, 0, 1, 0, 1}};
|
Let's move away from games, and just make a standard array.
int arr[10][20];
Let's say I want to make the variable in the 5th row and 10th column equal to 15.
We have two variables. Variables m and n.
N will represent the row, m will represent the column.
Now, all we have to do to set a variable in on the 5th row and 10 columns is set the variables to where the array element is located.
Now just put the variables in the appropriate places, and change the value to what you'd like.
arr[n][m] = 15;
And you're done.