[fpc-pascal] Array initialization

Francisco Reyes lists at stringsutils.com
Wed Mar 18 00:50:21 CET 2009


On the following URL, 
http://web.mit.edu/sunsoft_v5.1/www/pascal/lang_ref/ref_data.doc.html#1212, 
I found some different syntax to initialize an array.

Examples there..
var
c1 :  array[1..10] of char := '123456';
int2 : array[1..100] of integer := [50 of 1, 50 of 2];

Tried those, but didn't seem to to work.

Is a loop the only way to initialize all the values in an array other than
Values: array[1..2] of integer = (0,0);

In the program I am working on, Values will be an array of 128 integers and 
I would like to initialize them to 0.

Right now I just using:
for InitialLoop := 1 to 128 do
	Values[InitialLoop] :=0;




More information about the fpc-pascal mailing list