You are on page 1of 1

DIFFERENCE BETWEEN HEAP MEMORY AND STACK MEMORY

1. Heap memory is used for dynamic memory allocation while stack memory is used for
static memory allocation.
2. Heap memory is managed explicitly and the variables are created or initialized at run
time while stack memory is explicitly allocated for automatic variables and scope of
which are local to the block.
3.

You might also like