July 2013
Intermediate to advanced
124 pages
1h 42m
English
CHAPTER 7
![]()
Arrays
An array is a data structure used for storing a collection of values that all have the same data type.
Array declaration and allocation
To declare an array you start as you would a normal variable declaration, but in addition append a set of square brackets following the array’s name. The brackets contain the number of elements in the array. The default values for these elements are the same as for variables – elements in global arrays are initialized to their default values and elements in local arrays remain uninitialized.
int myArray[3]; // integer array with 3 elements
Array assignment
To assign values to the elements you ...
Read now
Unlock full access