Records and structures – HP SunSoft Pascal 4.0 User Manual

Page 218

Advertising
background image

194

Pascal 4.0 User’s Guide

8

Records and Structures

Records and structures pass as follows:

The FORTRAN subroutine,

StruChr.f

subroutine StruChr ( vls )

structure /VarLenStr/

integer nbytes

character a*25

end structure

record /VarLenStr/ vls

vls.a(1:5) = 'oyvay'

vls.nbytes = 5

return

end

The Pascal main program,

StruChrmain.p

program StruChrmain;

type

lenstr =

record

nbytes: integer;

chrstr: array [0..25] of char

end;

var

v: lenstr;

procedure struchr(var v: lenstr);

external fortran;

begin

struchr(v);

writeln('v.chrstr = "', v.chrstr, '"');

writeln('v.nbytes =', v.nbytes: 2)

end. { StruChrmain }

Advertising