By default, the lower bound for a C or C++ array is 0, and the lower bound for a Fortran array is
1. In the following example, an array of ten integers is declared in C and then in Fortran:
The elements of the array range from a[0] to
a[9] in C, while the elements of the equivalent Fortran array range from
a(1) to
a(10).
TotalView also lets you cast a variable to an array. In the GUI, just add an array specifier to the
Type declaration. For example, adding
(3) to a variable declared as an
integer changes it to an array of three
integers.
When the lower bound for an array dimension is the default for the language, TotalView displays only the
extent (that is, the number of elements in the dimension). Consider the following Fortran array declaration:
Since both dimensions of this Fortran array use the default lower bound, which is 1, TotalView displays the data type of the array by using only the extent of each dimension, as follows:
If an array declaration doesn’t use the default lower bound, TotalView displays both the lower bound and upper bound for each dimension of the array. For example, in Fortran, you declare an array of integers with the first dimension ranging from –1 to 5 and the second dimension ranging from 2 to 10, as follows:
When editing an array’s dimension, you can enter just the extent (if using the default lower bound), or you can enter the lower and upper bounds separated by a colon.