Dynamic Memory Allocation

c++

Solution

You don't have to know the size of the array in advance, or over-allocate memory to account for large arrays. This allows your program to be more efficient with its memory use.

Problem

What are the advantages of using dynamic memory allocation to create an array compared to the ordinary allocation of elements in an array?

Original source