![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395122x1.png)
6
The Pascal procedure, FixVec.p
The C main program, FixVecMain.c
type
VecTyp = array [0..8] of integer;
procedure FixVec(var V: TVec; var Sum: integer); var
i:integer;
begin
Sum := 0;
for i := 0 to 8 do Sum := Sum + V[i]
end; { FixVec }
#include <stdio.h>
extern void FixVec(int [], int *);
int main(void)
{
int Sum;
static int a[] = {0,1,2,3,4,5,6,7,8};
FixVec(a, &Sum); printf(" %d \n", Sum);
}
The commands to compile and execute FixVec.p and FixVecMain.c
hostname% pc
36
Although it does not apply in this example, arrays of aggregates in Pascal have, by default, a size that is always a multiple of four bytes. When you use the
The following example illustrates this point. The string 'Sunday' only gets through to the C main program when you compile the Pascal routine using
98 | Pascal 4.0 User’s Guide |