...

/

Automatic vs Static Variables

Automatic vs Static Variables

An introduction to automatic and static variables.

Two kinds of local variables

We talked about variable scope and the idea that variables declared within a function are local to that function. What actually happens is that each time a function is called by another piece of code, all the variables declared within the function are created (that is, memory is allocated to hold them). When the function is finished, all of that local memory storage is deallocated, ...