Programmer Guide > Using Subscripts with Arrays > Memory Order
  

Memory Order
To optimize performance, it is useful to know the memory order of the elements in the array. Given a 2-by-3 array created with the statement
a = INTARR(2, 3) 
the elements of A are ordered in memory as:
A0, 0 , A1, 0 , A0, 1 , A1, 1 , A0, 2 , A1, 2
Similarly, in arrays of dimension higher than two, the elements are stored such that the first dimension varies fastest, the next dimension varies the next fastest, and so on. For more information, see "Subscript Reference Discussion".
Knowing the memory order is also important when subscripting multidimensional arrays with a single subscript, in which case the array is treated as a vector with the same number of elements. In the above example, A(2) is the same element as A(0,1) and A(5) is the same element as A(1,2).

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.