This is mastery 23! I must tell you this is a special post because weeks ago I was completely lost with vectors and now I’ll be talking to you about it. Nice, right?
I’ll explain them to you answering two questions I had myself.
- When to use vectors over arrays?
So, arrays can hold only a certain number of elements. When you want to let the user decide how many elements the list can have you should work with vectors!
2. How to create a function with vectors? Here’s an example:
int function(vector<int>x)
Here’s a code in which I used vectors:
https://github.com/mferflores/Vectors/blob/master/find_threes
Check out the animated video I made to make it all clearer!
Creation and use of vectors in C++ by Mferflores is licensed under a Creative Commons Attribution 4.0 International License.