174
Pascal 4.0 User’s Guide
8
Example 1: Single-Dimension Array
Example 2: Array of Characters
The Pascal procedure,
IntCA.p
. Pascal passes the
bounds by value.
procedure intca_(var a: array [lb..ub: integer] of integer);
begin
a[1] := 1;
a[2] := 2
end; { intca_ }
The FORTRAN main program,
IntCAmain.f
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.
procedure chrca_(var a: array [lb..ub: integer] of char);
begin
a[0] := 'T';
a[13] := 'o'
end; { chrca_ }
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......