Answered step by step
Verified Expert Solution
Question
1 Approved Answer
program MAIN; var i : integer; var a : array[1, 2, 3, 4] of integer; subprogram SUBPROG(x : integer); {a[i]++; x++; i++; a[i] := 3;
program MAIN; var i : integer; var a : array[1, 2, 3, 4] of integer;
subprogram SUBPROG(x : integer); {a[i]++; x++; i++; a[i] := 3; i++; a[i] := a[i+1] + x; i++; x++;} (endSUBPROG)
{a[1] := 2; a[2] := 1; a[3] := 2; a[4] := 1; i := 1; call SUBPROG(a[i]); print(a[1..4]);} (endMAIN)
NOTE: Assume that all uninitialized variables have the value zero. Assume that addresses for pass by result parameters are bound at the time of call.
What is the program output assuming that the parameters are passed by value?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started