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

  • 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 153
130 Pascal 4.0 Users Guide
6
Function Return Values
Function return values match types in the same manner as with parameters,
and they pass in much the same way. See “Variable Parameters” on page 94.
The following example shows how to pass simple types.
The Pascal main program,
SimValMain.p
program SimVal(output);
var
t: boolean := true;
f: boolean := false;
c: char := 'z';
si: integer16 := 9;
i: integer := 9;
sr: shortreal := 9.9;
r: double := 9.9;
args: integer;
procedure SimVal(
t, f: boolean;
c: char;
si: integer16;
i: integer;
sr: shortreal;
r: double;
var Reply: integer);
external c;
begin
SimVal(t, f, c, si, i, sr, r, args);
writeln(' args = ', args :6 oct);
end. { SimVal }
The commands to compile and
execute SimVal.c and
SimValMain.p
hostname% cc -c SimVal.c
hostname% pc SimVal.o SimValMain.p
hostname% a.out
args=111111
Zobrazit stránku 153
1 2 ... 149 150 151 152 153 154 155 156 157 158 159 ... 332 333

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

Žádné komentáře