What will be the output of the following program assuming that parameter…

PYQ GATE 1999

What will be the output of the following program assuming that parameter passing is (i) call by value, (ii) call by reference, (iii) call by copy restore?

procedure P(x, y, z);
  begin y := y + 1; z := z + x end;
begin
  a := 2; b := 3;
  P(a + b, a, a);
  print(a)
end

Sign up free to check your answer

Sign up free

Explore the full course: Compiler Design

Loading lesson…