C++ Dynamic Arrays vs Dynamically Allocated Arrays
C++ Dynamic Arrays vs Dynamically Allocated Arrays. In this video, you will learn what the difference is between a dynamic array and a dynamically allocated array. A dynamically allocated array is simply an array created on the heap memory. A dynamic array however is an array that "resizes". The idea behind the resizing is simply creating another array on the heap with twice the capacity and copying over the values. The vector uses such a "resizable" array and is therefore a dynamic array.
C++ Dynamically Allocated Array. More often referred to as a dynamic array, although this is incorrect since dynamic array refers to another concept, but we will discuss that in another video. In this video you will learn how to allocate an array on the heap. This is referred to as a dynamically allocated array, which defers from a statically allocated array on the stack. By creating an array on the heap, the array capacity does not need to be determined at compile time. For this reason, we can create an array that can have varying sizes.
If you need to review these topics:
Arrays: https://youtu.be/TjIUYNdbmFk
Vectors: https://youtu.be/OGQQK-hmOpE
Pointers: https://youtu.be/FSOnAszRFTk
Pointers to Arrays/ Pointer Arithmetic: https://youtu.be/mlTjAmqtNA8
Null Pointers: https://youtu.be/1QMJQ8dCzJQ
Dynamic Memory Allocation: https://youtu.be/LFwq0cCyazA
C++ Playlist:
https://www.youtube.com/playlist?list=PLnKe36F30Y4ZDNIOZ51sX25pWKQ1pkpTE
Install C++ with VS Code:
https://youtu.be/DMWD7wfhgNY
Subscribe for more coding tutorials 😄!
Other Videos By Kenny Yip Coding
2024-05-13 | Code Tic Tac Toe in Python |
2024-04-25 | C++ Recursion with Vectors |
2024-04-24 | Recursion in C++ |
2024-04-23 | Functions in C++ Practice Problems |
2024-04-22 | C++ Templates and Generics Functions |
2024-04-17 | C++ Const Reference |
2024-04-16 | C++ Function Overloading |
2024-04-15 | C++ Functions Pass by Value or Reference |
2024-04-08 | C++ Functions |
2024-03-27 | Pointers to Pointers C++ |
2024-03-26 | C++ Dynamic Arrays vs Dynamically Allocated Arrays |
2024-03-25 | C++ Dynamic Arrays (Dynamically Allocated Array) |
2024-03-20 | Dynamic Memory Allocation in C++ |
2024-03-19 | C++ Pointers and Arrays |
2024-03-18 | C++ Null Pointers |
2024-03-14 | References in C++ |
2024-03-13 | C++ Const Pointers vs Pointer To Const |
2024-03-12 | Pointers in C++ |
2024-03-11 | Tic Tac Toe Game in C++ |
2024-03-10 | Multidimensional Arrays in C++ (2D arrays) |
2024-02-29 | Rock Paper Scissors Game in C++ |