tags:

views:

61

answers:

1
program s;
  type info = record
       name, surname: string;
       min, sec: integer;
  end;
  arrays = array[2..50] of info;

  var A: arrays;
begin
  A[1].name := 'name';
end.

What is wrong with that? It gives me range check error and I have no idea what is that.

+4  A: 

It gives you an error because you are creating an array from indexes 2 to 50.

So the first element you can access would be 2.

begin
  A[2].name := 'name';
end.

A range check error means that you are trying to access an array in an invalid position (hence, out of range). Pascal, unlike other languages, throws a compilation error if you do this.

Tom
Oh my god, how stupid I am. Thank you.
hey