Sun Microsystems SunSoft Pascal 4.0 User Manual page 124

Hewlett-packard user guide printer printer
Table of Contents

Advertisement

6
The Pascal procedure,
UniVec.p, which defines a 10-
element array
The C main program,
UniVecMain.c, which passes
a 3-element array to the Pascal
procedure written to do a 10-
element array
100
The univ Arrays
You can pass any size array to a Pascal procedure expecting a univ array,
although there is no special gain in doing so, because there is no type or size
checking for separate compilations. However, if you want to use an existing
Pascal procedure that has a univ array, you can do so. All univ arrays that
are in, out, in out, or var parameters pass by reference.
type
TVec = array [0..9] of integer;
procedure UniVec(
var V: univ TVec;
in Last: integer;
var Sum: integer);
var
i: integer;
begin
Sum := 0;
for i := 0 to Last do
Sum := Sum + V[i];
end; { UniVec }
#include <stdio.h>
extern void UniVec(int *, int, int *);
int main(void)
{
int Sum;
static int a[] = {7, 8, 9};
UniVec(a, 2, &Sum);
printf(" %d \n", Sum);
}
Pascal 4.0 User's Guide

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents