Allocating memory on the stack simply implies subtracting a value from the stack pointer; allocating on the heap involves a more complicated function call with higher overhead which only makes sense for larger datastructures.Is there any other reason why not to use the heap for regular variables?
The stack and heap are both finite in size, but there is typically more memory available on the heap.
Bookmarks