Tell me why he writes that an undeclared identifier, because I announced everything?
var n,m:integer; massivCHisel : array [ n,m ] of integer; The error is in the array "array [ n,m ]" .
Tell me why he writes that an undeclared identifier, because I announced everything?
var n,m:integer; massivCHisel : array [ n,m ] of integer; The error is in the array "array [ n,m ]" .
The point here is this. In contrast to C-like languages in pascal / delphi, declaring an array implies specifying not the size of the array, but the starting and ending indices. That is, if you need a two-dimensional array of size n x m, then it should be declared like this:
massivCHisel : array [1..n, 1..m] of integer; if you wanted to create a one-dimensional array with indices from n to m, then so:
massivCHisel : array [n..m] of integer; But that's not all. Such an array declaration assumes that the values of its indices are known at the compilation stage, that is, the above entries are still not correct, since m and n are not constants, but variables. In order to compile the example, you need to do something like:
const n = 5; m = 6; var massivCHisel : array [1..n, 1..m] of integer; If you are interested in the possibility of defining the boundaries of an array using variables, then it makes sense for you to look towards dynamic arrays
array[TFonstStyle, Boolean] of - Kromster SeptSource: https://ru.stackoverflow.com/questions/373623/
All Articles