HP SunSoft Pascal 4.0 Instrukcja Użytkownika Strona 133

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 333
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 132
The C–Pascal Interface 109
6
The C main program,
VarRecMain.c
#include <stdio.h>
struct vlr {
char tag;
union {
struct {
char ch1, ch2;
}a_var;
struct {
char flag;
}b_var;
struct {
int ALIGN;
}c_var;
}var_part;
};
extern void VarRec(struct vlr *);
int main(void)
{
struct vlr *x;
x = (struct vlr *)malloc(sizeof(struct vlr));
x->tag = 'a';
x->var_part.a_var.ch1 = 'a';
x->var_part.a_var.ch2 = 'b';
VarRec(x);
printf(" %c \n", x->var_part.a_var.ch2);
}
The commands to compile and
execute VarRec.p and
VarRecMain.c
hostname% pc -c -calign VarRec.p
hostname% cc VarRec.o VarRecMain.c -lpc
hostname% a.out
Z
Przeglądanie stron 132
1 2 ... 128 129 130 131 132 133 134 135 136 137 138 ... 332 333

Komentarze do niniejszej Instrukcji

Brak uwag