Function return values – HP SunSoft Pascal 4.0 User Manual
Page 208
Advertising
184
Pascal 4.0 User’s Guide
8
Function Return Values
Function return values match types the same as with parameters, and they
pass in much the same way. See “Procedure Calls: FORTRAN-Pascal” on
page 168.
The FORTRAN main program,
PassPtrmain.f
. In the
FORTRAN main program, the
name is converted to lowercase.
Uppsercase is ignored.
program PassPtrmain
integer i
double precision d
integer iptr, dptr
pointer ( iPtr, i ), ( dPtr, d )
iPtr = malloc( 4 )
dPtr = malloc( 8 )
i = 0
d = 0.0
call PassPtr ( iPtr, dPtr )
write( *, "(i2, f4.1)" ) i, d
stop
end
The commands to compile and
execute
PastPtr.p
and
PassPtrmain.f
hostname% pc -c PassPtr.p
hostname% f77 PassPtr.o PassPtrmain.f -lpfc -lpc
PassPtrmain.f:
MAIN passptrmain:
hostname% a.out
9 9.9
Advertising