1

I want to make a dynamic array of class objects. Though it is dynamic I have to calculate some size before initiating them; what strategy should I apply?

1 Answer 1

12

Use the std::vector class from the standard library. That implements a strongly-typed dynamic array. It can be found inside the header <vector>.

Sign up to request clarification or add additional context in comments.

2 Comments

can it store my custom data type defined in class?
@shak: Use std::vector<my_class> to store objects of your class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.