when we define push_back operation we double the array when size becomes equal to max size so suppose we started with 2 and if we insert 4element (during insertion or should before insertion size should become 8(max size)) but in the last example when the faculty is finding capacity using custom defined file it shows size equal to 4 only
When will size become double
Hello @great in this rhe size of the vector in the begining was 2 and then when you push more elements first it will become 4 in size adn when you will push 5 th element in it then it will become 8 in size.
if you have any other doubt you can ask here:
HappyLearning!!
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.