Originally Posted by devnull69
1 - You are accessing the variable w in the global scope (i.e. outside of any function). But you declared w to be local to the function "getWeight". Outside of this function you neither declare nor define it, so it is undefined.
He also has w
in the function getVolume( )
, just to confuse things further.
And since he never even *CALLS* the function getWeight()
, even if w
was global there is nothing that assigns a value to it.
And the same problem exists with variable v
. Although he sets that local variable
of that name in getVolume()
it will not exist at global scope, either.