1. ## Embaracing Array question

Hi everyone

This is a REALLY silly question but:

if I declare an array like this:

Code:
`uint8_t myArray[5];`
I get a one dimensional array of uint8_ts...

0
0
0
0
0

If I declare a two dimensional array like this:

Code:
`uint8_t myArray[5][1];`
Does this create an array with two rows in it?

0 0
0 0
0 0
0 0
0 0

So if I declare a two dimensional array like this:

Code:
`uint8_t myArray[5][2];`
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

and so on...

The bit that is confusing me is that the first location in an array is zero, therefore if I had an array width of 1 does this mean I get two rows in the array or just one?

Thanks to anyone who can clear this up

D

2. Just like the first 5 means that you have five element rows, the second number means how many elements in the column you have. So if you want two elements in a row, your second set of brackets should have 2 in it - the valid values to index these columns would be 0 and 1. If you want three columns, use 3 for the declaration, and 0..2 for indexing when grabbing the values out.

--
Mats

3. If I declare a two dimensional array like this:

Code:
`uint8_t myArray[5][1];`
Does this create an array with two rows in it?

0 0
0 0
0 0
0 0
0 0
A two dimensional array? Yes, it creates a two dimensional array. With two rows (you mean columns?)? No, the second dimension is 1 so it is more like:
0
0
0
0
0