Problem set 3

Assigned: Feb. 21.
Due: Mar. 6
.

Problem 1

Consider the following pseudo-code.
int I,J;                      // Global variables

void foo(int X,Y)
{ X = Y+I;
  Y = X+I;
}
  
main() {
  I=10;
  J=20;
  foo(I,J)
  print(I,J);
}

What does this program print, if parameters are passed (A) pass by value; (B) pass by reference; (C) pass by copy-restore?

Problem 2

Scott exercise 8.3 (on non-initialized values in C).

Problem 3

Scott exercise 8.8 (on using expressions as actual parameters in Fortran).