If you index into an operand that isn’t an array, or if you pass an argument that isn’t an array to an open array parameter, you’ll see this error notice.
program Produce; var P: ^Integer; I: Integer; begin Writeln(P[I]); end.
We attempt to apply an index to a pointer to an integer, which is legal in C but not in Delphi.
program Solve; type TIntArray = array [0..MaxInt DIV sizeof(Integer)-1] of Integer; var P: ^TIntArray; I: Integer; begin Writeln(P^[I]); (*Actually, P[I] would also be legal*) end.
We must tell the compiler that we want P to point to an array of numbers in the Delphi language.
Leave a Reply