CECS 424 Assignment 12

$25.00

Download Details:

  • Name: Assignment-12-dvkg0t.zip
  • Type: zip
  • Size: 389.92 KB

Category: Tags: ,

Description

Rate this product

1. (5 points) Elaborate on the reasons why even though parameters passed in registers may
sometimes need to have locations in the stack.
2. (10 points) Consider the following function and call:
procedure f(x, y, z)
x := x + 1
y := z
z := z + 1
. . .
i := 1; a[1] := 10; a[2] := 11
f(i, a[i], i)
print(i, a[1], a[2])
Determine the outputs of the program if arguments are passed 1) by value, 2) by reference, and 3) by name.

3. (10 points) Check out the output of the following program in C in your system and
suggest an explanation in terms of activation records in the stack.
void foo() {
int i;
printf(“%d “, i++);
}
int main() {
int j;
for (j = 1; j <= 10; j++) {
foo();
}
}