Arrays

Arrays are a type of Data Storage Structure that are used to hold multiple values of the same data type.

Arrays are initialized with a size and values are accessed with an index. Each value is called an element.

The index usually starts at 0, but sometimes starts at 1. The exam will specify which.

Zero starting arrays
The array is like this:

int numbers[5];

This means there are five elements, the first one is 0 and the last one is 4

Therefore, the index of the last element is the amount of elements minus one.

One starting arrays
The array is like this:

int numbers[5]

This means there are five elements, the first one is 1 and the last one is 5

Therefore, the index of last element is the number of elements.

Multi Dimensional
A multi dimensional array is simply an array of arrays.

Array Multi Dimensional Array The index numbers go from the top left with the first number indicating number of values down and the second indicating number of values right. In this example, the 5 is in arr[2,3] (0 based)