Judging by your comment, you are in a bit of a muddle.
In short, if you declare a parameter to a procedure to be an "array of", the array is always zero-based, regardless of the structure of the array you pass to it as an argument, as in
test(arr);
Try the code below. You'll find that when it runs, you get a Range-Check error on the line
a[5] := 'five';
That's because although arr has five elements, they are numbered 0..4, so there is no element of arr with index 5.
Although there are other was to declare procedure parameters, if you want to pass arrays to it as arguments, you have to make sure that either you mentally translate the array indexes as you write the code or (better) you declare the arrays you pass to it as zero-based, as I've done.
And, try and make a habit of turning range-checking on. It will catch error you yourself may overlook.
I'm going to leave you to rewrite your test procedure so that it works correctly as an exercise, because I'm "guessing" that what you've posted is some kind of school- or course-work and you should really put some effort into finding out how to correct your error yourself. If you're still stuck after reading this and trying the obvious solution, ask.
Btw, if you are using Delphi, look up "Open array parameters" in the Online Help. That explains the restrictions on using "array of ..." procedure-parameters.
Also btw, Rudy Velthuis says in his answer "But it is not necessary to do what {MartynA] proposes, using ArrayLoBound etc." That is true, it is not necessary but he has missed my point. If you hard-code array bounds, with values like 1 and 5, and then change them later, it is easy to overlook other values that need updating too, like in your for loop. Defining these values as consts is a good habit to get into because it avoids introducing inconsistencies, but more importantly makes sure you think about what you are doing. IME ...
program arrayparam;
const
ArrayLoBound = 0;
ArrayHiBound = 4;
var
arr : array[ArrayLoBound..ArrayHiBound] of string;
i : integer;
{$R+} // Turn range-checking on
procedure test(var a : array of string);
var
i : integer;
begin
a[1] := 'one';
a[2] := 'two';
a[3] := 'three';
a[4] := 'four';
a[5] := 'five';
for i := 1 to 5 do
writeln(a[i]);
end;
begin
test(arr);
writeln('-----');
for i := ArrayLoBound to ArrayHiBound do
begin
writeln(arr[i]);
if arr[i] = '' then
writeln('NOTHING');
end;
readln
end.
arris 1-based - " array[1..5] of string;"typeclause and use that. Example:type TArr = array[1..5] of string; ... procedure Test(var a: TArr);.