HP SunSoft Pascal 4.0 Manuale Utente Pagina 225

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 224
The FORTRAN–Pascal Interface 201
8
Function Return Values
Function return values match types the same as with parameters, and they
pass in much the same way.
Simple Types
The simple types pass in a straightforward way, as in this example:
The commands to compile and
execute PassPtr.f and
PassPtrmain.p
hostname% f77 -c PassPtr.f
PassPtr.f:
passptr:
hostname% pc PassPtr.o PassPtrmain.p -lpfc -lF77
hostname% a.out
9 9.9
The FORTRAN function,
RetReal.f
double precision function retreal ( x )
retreal = x + 1.0
return
end
The Pascal main program,
RetRealmain.p
program retrealmain;
var
r, s: real;
function retreal(x: real): real; external fortran;
begin
r := 2.0;
s := retreal(r);
writeln(r: 4: 1, s: 4: 1)
end. { retrealmain }
Vedere la pagina 224
1 2 ... 220 221 222 223 224 225 226 227 228 229 230 ... 332 333

Commenti su questo manuale

Nessun commento