### A good answer might be:

A local variable is a software entity that holds values for a subroutine while the subroutine is active.

# Implementation of Local Variables

In a high-level language a local variable is implemented as a location on the run-time stack. Each time a subroutine is activated new locations for variables are pushed onto the stack. The section of the stack for each activation is called a stack frame or an activation record. The frame pointer holds the address of the stack frame for a subroutine.

When a subroutine returns to its caller the stack frame is popped from the stack. Thus, local variables only exist as memory locations while a subroutine is active. A subroutine is active if it is currently executing, or if a subroutine it called is active.

The format of a stack frame used by MIPS language processors is complicated. There are many situations that must be handled and many optimizations. It takes a compiler to do it correctly. These notes describe a much simplified stack frame.

The important part is to understand what a local variable is: a location on the run-time stack. This is an important idea in Computer Science, one you will run into repeatedly as you study advanced topics.

### QUESTION 2:

In a high-level language are there variables that are not local?