Question: Consider the following pseudocode: What does this programprint if the language uses static scoping? What does it print with dynamic scoping? Why? x: integer --
Consider the following pseudocode:
What does this programprint if the language uses static scoping? What does it print with dynamic scoping? Why?
x: integer -- global procedure set xln : integer) x:= n procedure print.x() write.integer(x) procedure firstl) setx(1) print xl) procedure second() x : integer setx(2) print x() setx(0) first() print.x() second() print.x()
Step by Step Solution
3.37 Rating (166 Votes )
There are 3 Steps involved in it
With static scoping it prints 1 1 2 2 ... View full answer
Get step-by-step solutions from verified subject matter experts
