
The C–Pascal Interface 95
6
Simple Types without –xl
Without -xl, simple types match, as in the following example:
The Pascal procedure,
SimVar.p
procedure SimVar(
var t, f: boolean;
var c: char;
var si: integer16;
var i: integer;
var sr: shortreal;
var r: real);
begin
t := true;
f := false;
c := 'z';
si := 9;
i := 9;
sr := 9.9;
r := 9.9;
end; { SimVar }
The C main program,
SimVarMain.c
#include <stdio.h>
extern void SimVar(char *, char *, char *, short *,
int *, float *, double *);
int main(void)
{
char t, f, c;
short si;
int i;
float sr;
double r;
SimVar(&t, &f, &c, &si, &i, &sr, &r);
printf(" %08o %08o %c %d %d %3.1f %3.1f \n",
t, f, c, si, i, sr, r);
}
Komentarze do niniejszej Instrukcji