![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395145x1.png)
6
| Fixed Arrays |
| For a |
The C function, FixVec.c |
|
void FixVec(int V[9], int *Sum) | |
| { |
| int i; |
| *Sum = 0; |
| for (i = 0; i <= 8; i++) |
| *Sum = *Sum + V[i]; |
| } |
|
|
The Pascal main program,
FixVecMain.p
The commands to compile and execute FixVec.c and
FixVecMain.p
program FixVecMain(output); type
TVec = array [0..8] of integer;
var
V:TVec := [0, 1, 2, 3, 4, 5, 6, 7, 8]; Sum: integer;
procedure FixVec(var XV: TVec; var XSum: integer); external c;
begin
FixVec(V, Sum); writeln(Sum: 3); end. { FixVecMain }
hostname% cc
hostname% pc
36
The
The | 121 |