HP SunSoft Pascal 4.0 Manual de usuario Pagina 141

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 333
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 140
The C–Pascal Interface 117
6
Procedure Calls: Pascal–C
This section parallels the section, “Procedure Calls: C–Pascal” on page 93.
Earlier comments and restrictions also apply here.
Variable Parameters
Pascal passes all variable parameters by reference, which C can do, too.
Simple Types
Simple types pass in a straightforward manner, as follows:
The commands to compile and
execute IO.p and IOMain.c
hostname% pc -c IO.p
hostname% cc IO.o IOMain.c -lpc
hostname% a.out
Hello Pascal and St. Petersburg!
Hello C!
The C function, SimRef.c void SimRef(
char *t,
char *f,
char *c,
short *si,
int *i,
float *sr,
double *r)
{
*t = 1;
*f = 0;
*c = 'z';
*si = 9;
*i = 9;
*sr = 9.9;
*r = 9.9;
}
Vista de pagina 140
1 2 ... 136 137 138 139 140 141 142 143 144 145 146 ... 332 333

Comentarios a estos manuales

Sin comentarios