The built-in array type is a plain C construct, which is the same in C++.
Just as with C++ array collections, subscripts start at zero, the size must be a
constant, and arrays are created without a call to new.
The standard array has some shortcomings:
- Built-in arrays have no at() method, so they never perform
bounds-checks.
- Built-in arrays have no size() method. If you want to perform
your own bounds checks, you must have the size recorded somewhere, or
repeat the number in the code.
- Instead of an iterator type, native arrays can be scanned with
pointers. They are similar, since iterators were designed to resemble
pointers. There is the important difference that native arrays have
no end() method which could be
used to bounds-check them.
- Passing arrays as parameters does not follow the usual rules. (More on
that later.)
The array collection was added to C++ in large part to remedy these
deficiencies.
Textbook: Chapter 12. This chapter also discusses plain C strings, which are
just arrays of char. That is worth knowing, but I will not test you on it.