Untitled

Diego Plascencia Sanabria A01229988

An array stores a fixed sized sequential collection of elements of the same type, it is easier than creating different variables of the same type.

Declaring arrays.

You will need to specify the type of the elements and the number of elements required by an array:

type arrayName [ arraySize ];

eg:

double balance[10];

You can initialize arrays like shown in these examples:

double balance[5] = {1000.0, 2.0, 3.4, 17.0, 50.0};
(In this first case, the number of elements between braces cant belarger
than the number of elements that we declare for the array between brackets.)

double balance[] = {1000.0, 2.0, 3.4, 17.0, 50.0};
(In the second case, in the one you omited the size of
the array, the size will be as big as number of values that you decide.)

Here is the order that the values will gain in our array.

Untitled
visit the link for more detailed info:
http://www.tutorialspoint.com/cplusplus/cpp_arrays.htm

CC BY 4.0 Untitled by diego plascencia is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.