HP SunSoft Pascal 4.0 Instrukcja Użytkownika Strona 181

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 333
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 180
The C++–Pascal Interface 157
7
Arguments Passed by Value
Pascal arguments can also be passed by value. Here is how they work with
C++.
The Pascal main program,
SimRefMain.p
program SimRefMain (output);
var
t, f: boolean;
c: char;
i: integer;
s: integer16;
r: shortreal;
d: real;
procedure SimRef (
var t, f: boolean;
var c: char;
var i: integer;
var s: integer16;
var r: shortreal;
var d: real
); external C;
begin
SimRef (t, f, c, i, s, r, d);
writeln (t, f: 6, c: 2, i: 2, s: 2, r: 4: 1, d: 4: 1);
end.
The commands to compile and
execute SimRef.cc and
SimRefMain.p
hostname% CC -c SimRef.cc
hostname% pc SimRef.o SimRefMain.p
hostname% a.out
true false z 9 9 9.9 9.9
Przeglądanie stron 180
1 2 ... 176 177 178 179 180 181 182 183 184 185 186 ... 332 333

Komentarze do niniejszej Instrukcji

Brak uwag