7

The C++ main program, SampMain.cc

#include <stdio.h>

extern "C" void Samp (int&, double&); int main(void)

{

int i; double d; Samp (i, d);

printf ("%d %3.2f \n", i, d);

}

The commands to compile and execute Samp.p and

SampMain.cc:c

hostname% pc -c Samp.p

hostname% CC Samp.o SampMain.cc -lpchostname% a.out

7 3.14

Arguments Passed by Reference

C++ arguments can be passed by reference. This section describes how they work with Pascal.

The C++–Pascal Interface

139

Page 163
Image 163
HP SunSoft Pascal 4.0 manual Arguments Passed by Reference, C++ main program, SampMain.cc, Hostname% pc -c Samp.p