Arrays are one of the most important software constructs. What they do is very simple; they allow you to organise things as a list. In object-oriented languages arrays can be a list of anything.

It is even possible to have a list of lists. These are called multi-dimensional arrays. A lit of lists of lists is, for example, a three dimensional array. But lets keep it simple. Observe the code below. There are multiple ways that an array can be declared .. .each always involves the use of square brackets:

  // Declare an array that will store 6 values
  int circleDiameters[6]; 

  // Declare an array by populating it with values immediately
  int circleDiameters[] = {10, 16, 23, 45, 23};

  // Declare an array that will store 10 values, but only populate it with 5 values
  int circleDiameters[10] = {10, 16, 23, 45, 23};

Here’s how you would assign a value:

  circleDiameters[3] = 12; 


Here’s how you would access a value

  display.drawCircle(10,10, circleDiameters[3], 1);