8

The Pascal procedure, IntCA.p. Pascal passes the bounds by value.

The FORTRAN main program, IntCAmain.f

Example 1: Single-Dimension Array

procedure intca_(var a: array [lb..ub: integer] of integer);

begin

a[1] := 1;

a[2] := 2 end; { intca_ }

integer k integer s(0:2)

data

s / 0, 0, 0 /

call IntCA ( s, %VAL(0), %VAL(2) ) do k = 0, 2

write( *, "(I1)" ) s(k) end do

stop end

The commands to compile and execute IntCA.p and

IntCAmain.f

hostname% pc -c IntCA.p

hostname% f77 IntCA.o IntCAmain.f -lpfc -lpc IntCAmain.f:

MAIN: hostname% a.out 0 1 2

The Pascal procedure, ChrCA.p. Pascal passes the bounds by value.

Example 2: Array of Characters

procedure chrca_(var a: array [lb..ub: integer] of char);

begin

a[0] := 'T';

a[13] := 'o' end; { chrca_ }

174

Pascal 4.0 User’s Guide