3 ms·
Pascal, contrary to what the article states, allows any subrange of integer as an array index. For example, kernel: array[-3..3,-3..3] of real; is a 7x7
by DonaldFisk 6y ago
Pascal, contrary to what the article states, allows any subrange of integer as an array index. For example,
kernel: array[-3..3,-3..3] of real;
is a 7x7 array. It has negative indices, e.g.
x := kernel[-3,-3];
See https://www.tutorialspoint.com/pascal/pascal_arrays.htm https://www.tutorialspoint.com/pascal/pascal_arrays.htm
Sometimes you want negative indices, e.g. when performing a convolution on an image with a kernel.
- pmeira 6y agoTo complement, dynamic arrays ("array of ...") are always 0-based in Delphi and Free Pascal. This was apparently introduced in Delphi 4 (1998).