std::vector lives in the
<vector> header. So first, we need to add this line of code at the top of the program:
#include is a preprocessor directive that tells the compiler to include whatever library that follows. In our case that is the standard
And the syntax to create a vector looks like:
So to define a vector of
Inside the angle brackets is the data type of the vector. After the angle brackets is the name of the vector.
Note: The type of the vector (i.e., what data type is stored inside) cannot be changed after the declaration.