Two-Dimensional Arrays; Storing Values - AMX AXCESS CONTROL SYSTEM PROGRAM Instruction Manual

Programming language
Table of Contents

Advertisement

Two-Dimensional Arrays

The previous sections described how to group data into arrays and how to manipulate those arrays
as single units. This section describes how to group multiple arrays together into one two-
dimensional array. Two-dimensional arrays provide greater flexibility and power for more complex
applications. This section includes explanations of the concepts involved, and example Axcess
programming code.
To understand the structure of the two-dimensional array, refer to the basic single variable. A
variable holds only one value at a time. Using arrays, you can create a variable that can hold many
values. Reference the desired value in the array with an index value. This allows you to store
several related values, and access any particular one.
A two-dimensional array can be declared with the INTEGER keyword, like a one-dimensional array
can. This allows values in the range Ø to 65,535 to be assigned to locations within the two-
dimensional array.
The two-dimensional array expands on the one-dimensional array in the same way the one-
dimensional array expands on the simple variable: it holds multiple one-dimensional arrays which
can be referenced with an index value. To declare a two-dimensional array:
DEFINE_VARIABLE
NAMES[1Ø][3Ø]
While a one-dimensional array has a single storage capacity value, a two dimensional array has
two. NAMES is a two-dimensional array that can hold ten one-dimensional arrays, with a storage
capacity of 30 characters each. The total storage capacity of NAMES is 10 characters by 30
characters, for a total of 300 characters. The variable NAMES can be used to store up to 10 names,
with a maximum length of 30 characters each. FIG. 17 depicts the structure of the array NAMES.
FIG. 17 The structure of a two-dimensional array

Storing Values

The method of storing values in a two-dimensional array is similar to that of a one-dimensional
array:
!
!
!
Axcess Programming Language
Assign values to individual locations.
Assign one-dimensional arrays, string literals, and string expressions to one of the one-
dimensional arrays inside the two-dimensional array.
Assign entire two-dimensional arrays to other two-dimensional arrays.
Two-Dimensional Arrays
59

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Axcess

Table of Contents