Question: 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,

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 calls A. Say which identifiers would be visible in A. (d) If C used dynamic scoping and the calling sequence is main calls A; A calls B. Say which identifiers would be visible in B.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!