Question: 3. Consider the following code written using Pascal syntax: var x,y: integer; (* global variables *) procedure f(a: integer, b: integer); var z: integer;

3. Consider the following code written using Pascal syntax: var x,y: integer; (* global variables *)

3. Consider the following code written using Pascal syntax: var x,y: integer; (* global variables *) procedure f(a: integer, b: integer); var z: integer; begin (* f *) b; Z : = X - := a y b end; - Z; = a + 1; begin (* main *) X := 2; y : = 3; f (x + y, y); end; Describe the effect of this program on the global variables x and y, assuming: a) call by reference as the underlying mechanism for passing parameters. b) textual substitution as the underlying mechanism for passing parameters.

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Lets analyze the provided Pascal code and its effects on the global variables x and y under the assu... View full answer

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!