Question PRG-CPP-0057
MediumWhat is the difference between v.size() and v.capacity() for a std::vector?
- A.
They are always equal
- B.
capacity is the number of bytes
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
C++ question
What is the difference between v.size() and v.capacity() for a std::vector?
They are always equal
capacity is the number of bytes
Sign up free to see the answer and a step-by-step explanation.
size is the number of elements; capacity is how many fit before reallocation
size includes deleted elements