Answers/Solutions to Exercises in Chapter 5, Exercise 7

E7: If a local variable is defined as static, does this make it global?

A7: In the lexical sense of the word, the answer is no. The name of the variable (due to lexical scoping) is only recognized within the function itself, so the variable cannot be access by name from the outside. However, being a static variable puts it into the static data section and thus it can be accessed from anywhere in the program by address, so in this sense it can be viewed as global.

Back to Answers/Solutions Index                          Back to Answers/Solutions for Chapter 5 Index