![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395177x1.png)
7
Simple Types
Simple types pass in a straightforward way, as in the following example:
The Pascal function, | function | RetReal (r: real): real; | |||
RetReal.p |
|
|
|
|
|
| begin |
|
|
| |
| RetReal := r + 1 | ||||
| end; |
|
|
|
|
The C++ main program, |
|
| |||
|
| ||||
#include | <stdio.h> | ||||
RetRealMain.cc |
|
|
|
|
|
| extern "C" double RetReal (double); | ||||
| int | main(void) | |||
| { |
|
|
|
|
| double | r, | s; | ||
| r | = | 2.0; |
| |
| s | = | RetReal | (r); | |
| printf (" %f \n", s); | ||||
| } |
|
|
|
|
|
|
|
|
|
|
The commands to compile and execute RetReal.p and
RetRealMain.cc
hostname% pc
hostname% CC RetReal.o RetRealMain.cc
3.000000
The | 153 |