Hello guys I'm a a beginner programmer that is currently reading C++ Primer 4th Edition. I have just finished learning about iterators, vectors, arrays and pointers. In the book it says that arrays and pointers are error prone, and that most modern programs use vectors and iterators over arrays and pointers. So my question is; is this true? Also, in what situations are arrays and pointers more benefical that vectors?
Arrays and pointers are more beneficial when you want to get close to the metal. Afaik std::vector<T> uses an std::size_t to store the size of the vector, so that uses some memory. Pointers are useful when you want to "point" to objects. They're especially useful since removing the pointer itself will not remove the data pointed to in memory.
Yes, although there are many more containers besides vectors, too.
Also, in what situations are arrays and pointers more benefical that vectors?
I've used arrays (C++ arrays mostly, but 4th edition doesn't cover those) to hold data known at compile time. Also, arrays have the occasionally useful property that they do not need an allocator. It's pretty rare overall. Pointers have many other purposes besides serving as iterators in arrays, as already pointed out.