Entrust Interview Question

What is the difference between a stack and a heap?

Interview Answer

Anonymous

Oct 12, 2022

The stack is used to keep track of the execution order of the program, such as functions. It is First In Last Out (FILO). The stack is also used for some variables such as arrays, which is why resizing, removing, and inserting array elements is an intensive task. The heap is used to store the program's memory, such as variables.