January 2015
Intermediate to advanced
96 pages
1h 20m
English
CHAPTER 6
![]()
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, ...
Read now
Unlock full access