An array is a series of elements of the same type placed in contiguous
memory locations that can be individually referenced by adding an index
to a unique identifier.
That means that, for example, we can store 5 values of type int
in an array without having to declare 5 different variables, each one
with a different identifier. Instead of that, using an array we can
store 5 different values of the same type, int for example, with a unique identifier.
// arrays example
#include <iostream>
using namespace std;
int billy [] = {16, 2, 77, 40, 12071};
int n, result=0;
int main ()
{
for ( n=0 ; n<5 ; n++ )
{
result += billy[n];
}
cout << result;
return 0;
}