Technical data
Fortran/Pascal Interface
51
Fortran
integer t (2,3)
t(1,1), t(2,1), t(1,2), t(2,2), t(1,3), t(2,3)
Pascal
var t: array[1..2,1..3] of integer;
t[1,1], t[1,2], t[1,3], t[2,1], t[2,2], t[2,3]
When a Pascal routine uses an array passed by a Fortran program, the
dimensions of the array and the use of the subscripts must be interchanged.
The example below shows the Pascal code that interchanges the subscripts.
In the following example, the Fortran routine calls the Pascal procedure p,
receives the value 99, and prints it out.
Fortran
INTEGER A(2,3)
CALL P (A, 1, 3)
WRITE (6,10) A(1,3)
10 FORMAT (1X, I9)
STOP
END
Pascal
TYPE ARRY = ARRAY [1..3,1..2];
PROCEDURE P_(VAR A:ARRY; VAR I,J:INTEGER);
BEGIN
A[I,J] := 99;
END;
In the next example, the Pascal routine passes the character string
“0123456789” to the Fortran subroutine S_, which prints it out and then
returns to the calling program.










