An array is a consecutive group of memory locations that all have the same name and the same type. To refer to a particular location or element in the array, we specify the name if the array and the position number of the particular element in the array. The position number contained within square brackets is more formally called a subscript or index, this number specifies the number of elements from the beginning of the array. This subscript must be an interger expresion.
Arrays occupy space in memory. The programmer specifies the type of each element and the number of elements required by an array:
type arrayName [ arraySize ] ; and the compiler reserves the appropiate amount of memory.
The elements of an array can also be inicialized in the array declaration by following the declaration with an equals sigh and comma-separated list enclosed in braces of inicializers.
The picture shows an example that I used in WSQ10 of an array.
To see the program you can check my Github: https:/
From “C++ How to program” by Deitel.