Technical data
Appendix
27.3 Data Types and Parameter Types
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 601
27.3.3.4 Using Arrays to Access Data
Arrays
An array combines a group of one data type (elementary or complex) to form a unit. You can create
an array consisting of arrays. When you define an array, you must do the following:
• Assign a name to the array.
• Declare an array with the keyword ARRAY.
• Specify the size of the array using an index. You specify the first and last number of the
individual dimensions (maximum 6) in the array. You enter the index in square brackets with
each dimension separated by a comma and the first and last number of the dimension by two
periods. The following index defines, for example, a three-dimensional array:
[1..5,-2..3,30..32]
• You specify the data type of the data to be contained in the array.
Example: 1
The following figure shows an array with three integers. You access the data stored in an array
using the index. The index is the number in square brackets. The index of the second integer, for
example, is Op_temp[2].
An index can be any integer (-32768 to 32767) including negative values. The array in the following
figure could also be defined as ARRAY [-1..1]. The index of the first integer would then be
Op_temp[-1], the second would be Op_temp[0], and the third integer would then be Op_temp[1].