 |
» |
|
|
 |
The size of an array is the product
of the extents of each dimension; if any extent is zero then the
array has no size and is known as a zero-sized array. Any of the
arrays described in this chapter may be zero-sized apart from assumed-sized
arrays which have no specified size. This concept of a zero-sized
arrays is important if a number of algorithms are to be expressed
naturally. Note that while zero-sized arrays have no elements, they do
still have a shape and this is important when they are used in array
expressions which are described below. Operations involving zero-sized
arrays are generally null operations. Following are some examples of zero-sized arrays: INTEGER, PARAMETER :: cases = 0 |
REAL :: data1(cases,2), data2(cases,3) |
! both data1 and data2 are explicit-shape |
! arrays and have zero size; data1 has |
! shape [ 0 , 2] and data2 has the shape |
! the array section b(i:n) becomes a |
! zero-sized array in the last iteration of |
WRITE(*,"(9a)",ADVANCE="NO") & |
(/ (title(i),i=1,cols) /) |
! if the variable cols is less than 1, then |
! the array constructor contains no values |
! and no data will be output |
|