The array is the fundamental data structure. All other data structures can be implemented using arrays. Arrays have the following properties:
A variable is accessed symbolically by the name, or label, of the variable. An array provides an ordered set of variables, which are accessed numerically through the array index.
The Pascal statements
Sum := 0; for I := 1 to 10 do Sum := Sum + Item[I];
add up 10 elements of the array Item.
The entire computer memory is an array. The index to a particular memory cell is called the address of the cell. In SAL, each cell is a byte. Conceptually, the memory organization is equivalent to the Pascal declaration:
m: array [0 .. size_of_memory] of char;
If I is an address in memory, then m[I] refers to the contents of the memory cell at address I.
In SAL, the memory array is implicitly defined and is the only array understood by SAL. Any other array is assigned from the memory array and can only be accessed through m[].
Cells from the memory array are allocated using the .space directive. For example:
A: .space 10
allocates 10 bytes of memory starting at location A. The initial contents of the memory cells are unspecified.
The general form of the .space directive reserves N bytes of memory starting at the address ArrayName:
{ ArrayName: } .space { N }