我已经定义了这个过程,其中
Player
是用户定义的记录。这是程序:
Player
但是我收到了这个错误:
main.pas(9,39)致命:语法错误,“OF”预期但“[”找到
我检查了一行
procedure print_scores(players : array[1..2] of Player);
begin
writeln;
writeln(' Player 1 (', players[1].player_name.firstname, ' ',players[1].player_name.lastname, ') |=| ', players[1].score);
writeln(' Player 2 (', players[2].player_name.firstname, ' ',players[2].player_name.lastname, ') |=| ', players[2].score);
writeln;
end;
是第9行。
答案 0 :(得分:2)
您无法在过程参数列表中定义数组类型。它必须单独定义。
type
TPlayers = array[1..2] of TPlayer;
程序是:
procedure print_scores(const Players: TPlayers);