Predict the output :
int main()
{ vector v(3);
for(int i=0;i<7;i=i+2) {
v.push_back(i);
}
cout<<v.capacity(); }
Predict the output :
int main()
{ vector v(3);
for(int i=0;i<7;i=i+2) {
v.push_back(i);
}
cout<<v.capacity(); }
It’s dynamic .
Size doubles when there is shortage.