Skip to content

Latest commit

 

History

History
executable file
·
29 lines (16 loc) · 954 Bytes

File metadata and controls

executable file
·
29 lines (16 loc) · 954 Bytes

Dynamic arrays

on the other hand, can change their size during runtime. This is accomplished through the use of pointers and memory allocation techniques such as new and delete.

1D Dynamic Array

2D Dynamic Array

Advantages of dynamic arrays

  • They can change size at runtime, allowing for more flexibility in the use of memory.
  • They can be resized easily, allowing for the addition or removal of elements as needed.

Disadvantages of dynamic arrays

  • They can be slower than static arrays due to the overhead of allocating and deallocating memory at runtime.
  • They are prone to memory leaks if not managed properly, leading to poor performance and stability issues.