http://en.wikipedia.org/wiki/Stack_%28data_structure%29
http://en.wikipedia.org/wiki/Call_stack
Basically there aren't enough CPU registers to hold every variable (there were only 3 on the C64!) and so often you have to store the loop index or return address for a function in an area of memory where you can get it back into a register easily later on. The data is stored in a LIFO manner as nomrally you exit the inner loop first, then an outer loop etc. Sometimes you get stack overflow when you get a loop or function calling itself over and over and never exiting properly.
http://en.wikipedia.org/wiki/Call_stack
Basically there aren't enough CPU registers to hold every variable (there were only 3 on the C64!) and so often you have to store the loop index or return address for a function in an area of memory where you can get it back into a register easily later on. The data is stored in a LIFO manner as nomrally you exit the inner loop first, then an outer loop etc. Sometimes you get stack overflow when you get a loop or function calling itself over and over and never exiting properly.