I've programmed a bit in Java in the past, but I'm now trying to learn Pascal. I'm getting a really weird issue though, maybe you guys can help. Here's my code (well, the problem bits anyway).
program Test;
var
myArray: array[1..200] of integer;
i: integer;
Procedure Test (Input: Array Of Integer);
begin
writeln('200th Entity is: ', Input[200]);
writeln('200th Entity is: ', myArray[200]);
end;
begin
for i:=1 to 9 do
myArray[i] := 10 + i;
test(myArray);
readln;
end.
The array of integers, 'myArray', is being inserted into the procedure 'Test', and no modifications are done, I'm simply reading the final integer in the array. Except the output is this:
200th Entity is: -6108936
200th Entity is: 0.
The second entry is the original array, the first is the copied one. Why are they different? It SHOULD be 0 in both. There are no problems for ANY other entries, if I do entry 199, both are 0. If I do 5, both are 15. If I do entry 200, one is 0 and one is some huge number (this number has varied through my various tests, can be +ve or -ve, once it was as low as 20, but its not random, every time I run the number is the same. But changing the code does affect this number.