Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

Where does a std::vector store its elements?

  1. A On the stack
  2. B On the heap, while the vector object itself may be on the stack
  3. C In static storage
  4. D In registers
Answer

On the heap, while the vector object itself may be on the stack

This is why a vector can hold far more data than a stack-allocated array, and why its destructor must free the buffer.

All C++ MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as