Search for question
Question

1. (8 points) Consider the C program given below. You will be asked to determine which variables are visible in a number of different situations. In each case, identify each variable by its name and the line number of its declaration. Note: for this problem, only list visible variable names, not function names.

(a) C uses static scoping. Say which variables are visible in the bodies of each of the functions: main, A, B. (b) If C used dynamic scoping and the calling sequence is main calls B. Say which identifiers would be visible in B. (c) If C used dynamic scoping and the calling sequence is main callsA. Say which identifiers would be visible in A. (d) If C used dynamic scoping and the calling sequence is main callsA; A calls B. Say which identifiers would be visible in B.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6