HP SunSoft Pascal 4.0 Manuale Utente Pagina 224

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 223
200 Pascal 4.0 Users Guide
8
Pointers
Pointers are easy to pass, as shown in the following example:
The FORTRAN subroutine,
PassPtr.f. In the FORTRAN
subroutine, the name is
converted to lowercase.
Uppsercase is ignored.
subroutine PassPtr ( iPtr, dPtr )
integer i
double precision d
pointer ( iPtr, i ), ( dPtr, d )
i = 9
d = 9.9
return
end
The Pascal main program,
PassPtrmain.p. In the
Pascal program, where it calls
the FORTRAN subroutine, the
name must be in lowercase.
program PassPtrmain;
type
PtrInt = ^ integer;
PtrReal = ^ real;
var
i: integer := 0;
r: real := 0.0;
iP: PtrInt;
rP: PtrReal;
procedure passptr(var xiP: PtrInt; var xrP: PtrReal);
external fortran;
begin
iP := addr(i);
rP := addr(r);
passptr(iP, rP);
writeln(i: 2, r: 4: 1)
end. { PassPtrmain }
Vedere la pagina 223
1 2 ... 219 220 221 222 223 224 225 226 227 228 229 ... 332 333

Commenti su questo manuale

Nessun commento