Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer's RAM .

You can use the stack if you know exactly how much data you need to allocate before compile time and it is not too big. You can use heap if you don't know exactly how much data you will need at runtime or if you need to allocate a lot of data.

More about.......Stack and Heap

Sponsored Links

Helsy