Exam Q’s and A’s
Scope - answer- region over which you can access a variable by name.
Name the four types of scopes - answer- * Program scope
* File scope
* Function scope
* Block Scope
Why is scoping important? - answer- programs become unmanageable without
scoping.
every part of program becomes attached to every other part of program.
Program scope definition in terms of a variable - answer- Variable is accessible by all
source files that make the executable.
List some components of C that follow program scope - answer- All functions and
extern variables
How does program scope works? - answer-
Program symbol definition - answer- Names used for data and functions
example of Program Symbol Concepts - answer- variable name, typedef, enum,
struct
Parts of a program symbol - answer- declaration
definition
reference
Declaration - answer- the process of associating a data type with the variable name.
(tells compiler about the name)
Definition - answer- store some value of the specified data type in the variable.
Reference - answer- use of the variable that has been declared and defined before.
example of program symbols in action: - answer- int a; //declaration
a = 0; //definition
a = a + a; //reference
part of References for symbol table - answer- store, load and call