- When the computer encounters the
definition of
the local variable r,
it creates it in RAM
(in other words:
reserve memory to
hold the value)
- When the computer executes the
method call, the
program execution is
transfered ,
to the
min method:
- When the computer encounters the
definition of
the local variable m,
it creates it in RAM
(in other words:
reserve memory to
hold the value)
- The program execution continues to
compute the minimum of
the input values and
store it in the local variable
m:
- The return(m)
statement will save the
value of variable m in
a return location:
The return location is
typically a
general purpose register inside
the CPU
(Central Processing Unit)
(CPU, see:
click here )
- When program execution reaches the
end of the function,
the local variable m
is destroyed:
Furthermore, the
program execution will be
transfered back to the
location of the method call.
- When program execution continues
the
location of the method call,
the assignment statement will stored the
value in the return location
to the
local variable r:
- And when the program
reaches the end of the main
method, the
local variable r
will also be
destroyed:
|