144
Pascal 4.0 User’s Guide
7
Fixed Arrays
The Pascal procedure,
FixVec.p
type
TVec = 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;
The C++ main program,
FixVedMain.cc
#include <stdio.h>
extern "C" void FixVec (
int [],
int &);
int main(void)
{
int Sum;
static int a[] = {1,2,3,4,5,6,7,8,9};
FixVec (a, Sum);
printf (" %d \n", Sum);
}
The commands to compile and
execute
FixVec.p
and
FixVecMain.cc
hostname% pc -c FixVec.p
hostname% CC FixVec.o FixVecMain.cc -lpc
hostname% a.out
45
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......