Summary
In this hour, you learned how to create arrays in C++. An array is a fixed-size collection of objects that are all the same type.
Arrays don't do bounds checking. Therefore, it is legal—even if disastrous—to read or write past the end of an array. Arrays count from 0. A common mistake is to write to offset n of an array of n members.
Arrays can be one-dimensional or multidimensional. In either case, the members of the array can be initialized, as long as the array contains either built-in types, such as int, or objects of a class that has a default constructor.
Arrays and their contents can be on the heap or on the stack. If you want to delete an array on the heap, remember to use the brackets in the call to delete or you will only delete ...
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