|

June 24th, 2006, 10:48 PM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Nick Y
Text refers to Figure 2.12 in 3rd paragraph, but Figure 2.12 on page 92 does not tie up with the description.
|
Exactly.
The variable value1, which appears at the beginning of the file, is declared at global scope, as is
value4, which appears after the function main(). The scope of each global variable extends from the
point at which it is defined to the end of the file. Even though value4 exists when execution starts, it
cannot be referred to in main() because main() is not within the variableâs scope. For main() to use
value4, you would need to move its declaration to the beginning of the file. Both value1 and value4
will be initialized with 0 by default, which is not the case for the automatic variables. Note that the local
variable called value1 in function() hides the global variable of the same name.
There is no value4, and the description doesnt match up with Fig. 2-12
|