Amhuxt.425
net.games.trivia
utzoo!decvax!harpo!eagle!mhuxt!presley
Mon Apr 26 12:32:58 1982
Answers to Parametrivia (mhuxt.420)
The problem was what the final values for B[1] and B[2] are,
using different forms of parameter passing in the following
ALGOL-like program:
-----
       BEGIN INTEGER I; INTEGER ARRAY B[1,2];
               PROCEDURE Q(X); INTEGER X;
               BEGIN I := 1; X := X + 2; B[I] := 10;
                     I := 2; X := X + 2;
               END;
         B[1] := 1; B[2] := 1; I := 1; Q(B[I]);
       END;
-----
call by..   B[1] B[2]
reference      12   1
value          10   1
value result    5   1
result       undef  1
name           10   3

       Joe Presley

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.