Reserve() function of vector

Since the doubling of the vector is an expensive operation, so we use the reserve() function to initialise with a certain amount of space. But can we simply use to initialise the size when the vector is declared like:-

vectorv(1000);

instead of:-
vectorv;

v.reserve(1000);

@Rohit39 hey in reserve you can not double the value like its fix, but when you use normal vector its size is not fix when its full it will double itself, yes if u want fix size you can use that reserve also.

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.