An Algol-60 example of passing parameters by name. The syntax is not guaranteed to be correct - it's hard to come across an Algol-60 compiler these days...

begin 
   integer array A[1:3];
   integer i;
   integer procedure what(n);
      integer n;
      begin 
         for i:= 1 step 1 until 3 do n := i
      end;
   what(A[i])
end
Question 1: What is the result of the following code?
Question 2: Write a similar procedure to compute the sum of all elements in an array.
This is an example from CSci 4651 course.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.