Stack vs Heap

Keep in mind the pros and cons of allocation on stack versus heaps in order to make the right choices when creating variables.

We can choose to allocate space for a variable explicitly on the heap instead of the stack depending on our needs. To write effective code, the pros and cons for each type of allocation should be kept in mind.

Pros and cons

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy