Memory management technique of the data structure



There are two types of memory management techniques of data structure. These are :-


v  Static Memory Allocation Technique :-
                 Static memory allocation technique is used during compile time. In this all the variables occupy space in the memory whether they are assigned a value or not.

EXAMPLE:

                                int a,b,c,d;
a=b/c;
printf (“b”);

              In this we declare four variables a,b,c,d, but only three variables are used at compile time. But variable‘d’ also stored in to the memory. 

v Dynamic Memory Allocation Technique :-
                     The dynamic memory allocation technique is used at run time. In this the variables occupy memory space only when they assigned value to the variable during runtime.

EXAMPLE
int a,b,c,d;
a=b/c;
printf (“b”);

In this we declare four variables a,b,c,d, but only three variables are used at runtime. But variable ‘d’ is not  stored in to the memory because we not assign the value to the variable ‘d’, that’s why variable ‘d’ not store into the memory.

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart