Skip to main content
Engineering LibreTexts

6.10: Dynamic Arrays

  • Page ID
  • Overview

    A dynamic array is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard libraries in many modern programming languages. Dynamic arrays overcome a limit of static arrays, which have a fixed capacity that needs to be specified at allocation.[1]


    A limitation of the static arrays discussed so far is that the array size is determined when the array is created and/or allocated. Dynamic arrays allow elements to be added and removed at runtime. Most current programming languages include built-in or standard library functions for creating and managing dynamic arrays.

    Language Class Add Remove
    C++ #include <list>
    insert erase
    C# System.Collections.Generic.List Add Remove
    Java java.util.ArrayList add remove
    JavaScript Array push, splice pop, splice
    Python list append remove
    Swift Array append remove

    Key Terms

    dynamic array
    A data structure consisting of a collection of elements that allows individual elements to be added or removed.


    1. Wikipedia: Dynamic array
    • Was this article helpful?