Whenever possible, we use lists in favor of arrays. This chapter explains ways of grouping things together in lists and how to iterate through them.
There are many occasions when it is necessary to deal with collections of things. The classic approach in languages like C is to use arrays to store such collections. In C++ arrays are regarded as evil. Here are a few good reasons to avoid using arrays.
Array subscripts are not checked to make sure that they are not out of range. A programmer using an array has the responsibility to write extra code to do the range checking.
Arrays are either fixed in size or they must use dynamic memory from the ...