C Interfaces and Implementations: Techniques for Creating Reusable Software
by David R. Hanson - Princeton University
Chapter 10. Dynamic Arrays
An array is a homogeneous sequence of values in which the elements in the sequence are associated one-to-one with indices in a contiguous range. Arrays in some form appear as built-in data types in virtually all programming languages. In some languages, like C, all array indices have the same lower bounds, and in other languages, like Modula-3, each array can have its own bounds. In C, all arrays have indices that start at zero.
Array sizes are specified at either compile time or runtime. The sizes of static arrays are known at compile time. In C, for example, declared arrays must have sizes known at compile time; that is, in the declaration int a[n], n must be constant expression. A static array may be allocated at runtime; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access