[comp.lang.pascal] Defining variable length arrays

2flnrescue@kuhub.cc.ukans.edu (10/26/90)

Well, speaking as a programmer there is only really one kind of variable
length array, if I understand what you want correctly, and it is a dynamic
variable list.  Dynamic variable lists are daunting to even seasoned
programmers, they are only really effective when you need to store over
500 elements in an array/list format (or if your computer has very little
memory to work with and you don't want to create past its limit), and
they are slow.  However, it should not be hard to create a set of 
functions that allow one to access an element of the list similarly to
accessing an array.  This means that:

instead of  ArrayName[X]  being the access command,

function GetElement(ListName:List; WhichOne:integer):ElementType.

Thus you build the list from keyboard or file, and then access data:

instead of   CalculateSomething(ArrayName[X]);
it is        CalculateSomething(GetElement(ArrayName,X))

Anyway, that is basically what is needed to make a variable-length array.