int foo = 1; // globally visible. Lives until end of program.
function bar(void)
{
int temp = 2; // not visible outside of this function
return;
} // exactly here does the lifetime of the
// temp variable end. ALL memory within the function
// bar has been allocated on the stack.
// At return the stack is rolled back to where
// it was BEFORE the function was called.