September 1998
Intermediate to advanced
848 pages
20h 13m
English
An array is a set of elements that all have the same data type. Array elements are stored sequentially in memory and are accessed by using an integer index (or offset). In C, the first element of an array has an index of 0, so the final element in an array of n elements has an index of n - 1.
To declare a simple one-dimensional array, use this form:
type name[size];
Here, type is the data type for each and every element, name is the name of the array, and size is the number of elements.
C interprets the name of an array to be the address of the first element of the array. In other terms, the name of an array is equivalent to a pointer to the first element. In general, arrays and pointers are closely connected. If ar is an array, ...
Read now
Unlock full access