...

/

The Stack

The Stack

Learn about the stack and how it’s useful in allocating memory for functions.

So far, we have seen how to declare basic type variables such as int, double, etc, and complex types such as arrays and structures. The way we have been declaring such variables, so far, puts these variables on the stack.

What is the stack?

It’s a special region of your computer’s memory that stores temporary variables created by each function (including the main function). The stack is a LIFO data structure that’s managed and optimized by the CPU quite closely. ...