Example:
Factorial Program
l int
fac(int n)
{
int x,
a;
x = 1; a = 1;
while( x <= n )
{
a =
a*x;
x = x+1;
}
return a;
}
l The
state is the set of bindings to a, n, and x, which weÕll abbreviate
(a, n, x), called the state vector.
lExample:
(a, n, x): (1, 4, 1) ->
(1, 4, 2) -> (2, 4, 3) -> (6, 4, 4) -> (24, 4, 5)
l24 is returned as fac(4)