Static Memory Allocation and Dynamic Memory Allocation in C++.

Each variable uses space on computer’s memory to store its value.

When we use the term allocate, we indicate that the variable has been given a space on computer’s memory.

Deallocations means the space has been reclaimed by computer and the variable cannot be accessed now.

This article explains how this memory is allocated to variables in C++ programming language.


Memory is divided into two parts. First is called Stack memory and other is Heap memory.

Stack memory store variables declared inside function call and is generally smaller than heap memory.

Heap memory is used in dynamic memory allocation and is generally larger than stack memory.


Memory allocation in C++ is done by two methods.

One of them is Static Memory Allocation which is also called as Compile Time Allocation.

And the other one is called as Dynamic Memory Allocation which is also know as Run Time Allocation.

#software-engineering #software-development #software #c++ #cplusplus #programming-c

Memory Allocation in C++
1.10 GEEK