Stack and the heap

The stack holds all of the memory that is being used.
The heap has access to memory that isn't being used.

Am I correct?


The stack is a chunk of memory that is consumed by your program at startup. Functions put local variables on the stack so that they can be nested without having to dynamically allocate more space (since the space is already allocated on the stack).

The heap is for memory which needs to be dynamically allocated at runtime.
Topic archived. No new replies allowed.