Using Subscripts with Arrays
Subscripts provide a means of selecting one or more elements of an array variable. The values of one or more selected array elements are extracted when a subscripted variable reference appears in an expression. Values are stored in selected array elements, without disturbing the remaining elements, when a subscript reference appears on the left side of an assignment statement. The section
"Assignment Statement" discusses the use of the different types of assignment statements when storing into arrays.
The subscripts of an array element denote the address of the element within the array. In the simple case of a one-dimensional array, an n-element vector, elements are numbered starting at 0 with the first element, 1 for the second element, and running to n – 1, the subscript of the last element. Arrays with multiple dimensions are addressed by specifying a subscript expression for each dimension. For example, a two-dimensional n by m array is addressed with a subscript of the form: (i, j), where 0 < i < n and 0 < j < m.
In PV-WAVE, array subscripting is
enabled.