Too Long; Didn't Read
A stack and heap are different data structures used to store variables in memory. The pointer holds the location of where the actual data is stored, so we are just given a reference to it. It's about the speed compared to heaps, so instead of moving around a whole chunk of data(the heap) while mutating it, just carry the reference to the data. For static data types, variables are added directly onto the stack, meaning we would have no heap to store a simple 456.98 because the sizes of these sizes are already known.
Share Your Thoughts