what is stack and heap memory
Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computerâs RAM . Variables allocated on the stack are stored directly to the memory and access to this memory is very fast, and itâs allocation is dealt with when the program is compiled.