HP SunSoft Pascal 4.0 Uživatelský manuál Strana 123

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 333
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 122
The C–Pascal Interface 99
6
The Pascal procedure,
DaysOfWeek.p
type
TDay= array [0..8] of char;
TWeek = array [0..6] of day;
TYear = array [0..51] of week;
procedure DaysOfWeek(var Y: TYear);
begin
v[1][1] := 'Sunday';
end;
The C main program,
DaysOfWeekMain.c
#include <stdio.h>
extern void DaysOfWeek(char [][7][9]);
int main(void)
{
char Year[52][7][9];
DaysOfWeek(Year);
printf(" Day = '%s' \n", Year[1][1]);
}
The commands to compile and
execute DaysOfWeek.p and
DaysOfWeekMain.c
without
-calign
hostname% pc -c DaysOfWeek.p
hostname% cc DaysOfWeek.o DaysOfWeekMain.c -lpc
hostname% a.out
Day = ''
The commands to compile and
execute DaysOfWeek.p and
DaysOfWeekMain.c
with
-calign
hostname% pc -c -calign DaysOfWeek.p
hostname% cc DaysOfWeek.o DaysOfWeekMain.c -lpc
hostname% a.out
day = 'Sunday '
Zobrazit stránku 122
1 2 ... 118 119 120 121 122 123 124 125 126 127 128 ... 332 333

Komentáře k této Příručce

Žádné komentáře