Pointers and Dynamic Memory

Let's see how pointers can be used in dynamic memory.

Heap: The Dynamic Memory Store

The dynamic section of memory known is called heap. This is a vast space of memory which is not being managed by the CPU.

We can specify the amount of space we want, and a random portion of the heap will be reserved for us. While the heap does allow us to use as much space as we want, the look-up operation is slower compared to a stack. However, a variable in dynamic memory (heap) can have a “global” scope instead of just being a local variable for a function.

Objects in the Heap

Get hands-on with 1200+ tech skills courses.