sir is reserve and resize functions of vector object does sma e work???
Doubt in vectors
hi @tejasddongare
std::vector::reserve
will allocate the memory but will not resize your vector, which will have a logical size the same as it was before.
std::vector::resize
will actually modify the size of your vector and will fill any space with objects in their default state. If they are ints, they will all be zero.
This difference can be realised by the help of size and capacity functions.
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.