Back to Browse

C++ Tutorial: static vs dynamic memory

9.8K views
Sep 2, 2017
14:11

It can be confusing to know which type of memory to use in your programs. In this video I explain the differences between static and dynamic memory, and provide an example application of dynamic memory. static memory is allocated on the stack at compile-time. This means it is fixed in size for the duration of the program. dynamic memory is allocated on the heap at run-time. This means the size of the memory you get is determined /after/ the program has already started running. this benefit comes at a cost of requiring extra work. A pointer will be needed as well as two new key words, new and delete. It's up to the programmer to manage this memory in C++ and make sure there are no memory leaks.

Download

1 formats

Video Formats

360pmp416.7 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

C++ Tutorial: static vs dynamic memory | NatokHD