HP SunSoft Pascal 4.0 Manuale Utente Pagina 215

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 214
The FORTRAN–Pascal Interface 191
8
Fixed Arrays
For a fixed-array parameter, pass the same type and size by reference:
The FORTRAN subroutine,
FixVec.f
subroutine FixVec ( V, Sum )
integer Sum
integer V(0:8)
integer i
Sum = 0
do 2 i = 0, 8
2 Sum = Sum + V(i)
return
end
The Pascal main program,
FixVecmain.p
program FixVecmain(output);
type
VecTyp = array [0..8] of integer;
var
V: VecTyp := [1, 2, 3, 4, 5, 6, 7, 8, 9];
Sum: integer;
procedure fixvec(var XV: VecTyp; var XSum: integer);
external fortran;
begin
fixvec(V, Sum);
writeln(Sum: 4)
end. { FixVecmain }
The commands to compile and
execute FixVec.f and
FixVecmain.p
hostname% f77 -c FixVec.f
FixVec.f:
fixvec:
hostname% pc FixVec.o FixVecmain.p -lpfc -lF77
hostname% a.out
45
Vedere la pagina 214
1 2 ... 210 211 212 213 214 215 216 217 218 219 220 ... 332 333

Commenti su questo manuale

Nessun commento