An array is a collection of fixed size of data items of the same type. The benefit is that you can store a whole set of values under 1 single name only. You can refer to each one separately, as each value is stored in a separate cell.
The general definition is 
var
arrayname:array [indextype] of type;
You can e.g. create an array storing 100 integers. The declaration would be array [1.100] of integer; You can specify this as a type or directly in the variable specification part.

As type declaration:
type
arrint=array[1..100] of integer;
var
arrint1:arrint;
As declaration in variable part:
var
arrint:array[1..100] of integer;
Important notes:

Examples:
 
1. To print an array from the reverse onto the screen. 
program reverseorder(input,output);
type
arraytype = array [1..10] of integer;
var
arr:arraytype;
i:integer;
begin
for i:=1 to 10 do
arr[i]:=i;
for i:=10 downto 1 do
writeln(arr[i]);
end.

 
2. To read values into an array 
var
arr:array[1..4] of real;
i:integer;
begin
for i:=1 to 4 do
readln(arr[i])
end.
You can also have arrays of arrays. Moreover, there is another possibility 'packed array of char'. It is very useful, as you will see.

Packed array of Char

Rules:

Lets explain it with an example:
 
type
charstring = packed array [1..5] of char;
var 
name1,name2,name3 : charstring;
begin
name1:='Susan';
name2:='Mary '; {Note that you could not have written 'Mary' as the size must be 5.}
name3:=name1;
writeln(name1);
if name1>name2 then ..... {you can compare them according to the alphabetical ordering}
end.

Disadvantage:

You can also have arrays of packed arrays.

Multidimensional Arrays

Arrays of arrays are called multidimensional arrays. There could arise any reason for using this.

General form of declaration: arraytype = array [index1, index2, ... , indexn] of elementtype;

This is the same as array [index1] of array [index2] of .. array[indexn] of elementtype;

Example:

A : array [ 1..5,10..12,6..9,0..3] of integer;

Then they are referred to as: A[1,10,3,0] and can be used as simple integers.

A First Look A First Look at Pascal Basic Input/Output Identifiers & Types
Constants Standard Functions If..Then Statement Case Statement
Repetitions Procedures and Functions Enumerated /Subrange Types Sets
I/O, Text Files Arrays Records Recursion
Pointer How to Debug Previous Exam Questions Advanced
ASCII Code Table Homepage University Homepage Computer Engineering Dept.