An array constructor is a sequence of scalar values that is interpreted as a rank-one array. The array element values are those specified in the sequence. An array constructor takes the following form: (/ac-value-list/) ac-value-list Is a list of one or more expressions or implied-do loops. Each ac-value must have the same type and kind type parameter. An implied-do loop in an array constructor takes the following form: (ac-value-expr, do-variable = expr1, expr2 [,expr3]) ac-value-expr Is a scalar expression evaluated for each value of the d-variable to produce an array element value. do-variable Is the name of a scalar integer variable. Its scope is that of the implied-do loop. expr Is a scalar integer expression. The expr1 and expr2 specify a range of values for the loop; expr3 specifies the stride. The array constructor has the same type as the ac-value-list expressions. If the sequence of values specified by the array constructor is empty (there are no expressions or the implied-do loop produces no values), the rank-one array has a size of zero. The ac-value specifies the following: o If it is a scalar expression, its value specifies an element of the array constructor. o If it is an array expression, the values of the elements of the expression, in array element order, specify the corresponding sequence of elements of the array constructor. o If it is an implied-do loop, it is expanded to form an array constructor value sequence under the control of the DO variable, as in the DO construct. If every expression in an array constructor is a constant expression, the array constructor is a constant expression. If an implied-do loop is contained within another implied-do loop (nested), they cannot have the same DO variable (do-variable). There are three forms for an ac-value, as follows: C1 = (/4,8,7,6/) ! A scalar expression C2 = (/B(I, 1:5), B(I:J, 7:9)/) ! An array expression C3 = (/(I, I=1, 4)/) ! An implied-do loop You can also mix these forms, for example: C4 = (/4, A(1:5), (I, I=1, 4), 7/) To define arrays of more than one dimension, use the RESHAPE intrinsic function. The following are alternative forms for array constructors: o Square brackets (instead of parentheses and slashes) to enclose array constructors; for example, the following two array constructors are equivalent: INTEGER C(4) C = (/4,8,7,6/) C = [4,8,7,6] o A colon-separated triplet (instead of an implied-do loop) to specify a range of values and a stride; for example, the following two array constructors are equivalent: INTEGER D(3) D = (/1:5:2/) ! Triplet form D = (/(I, I=1, 5, 2)/) ! Implied-do loop form The following example shows an array constructor using an implied-do loop: INTEGER ARRAY_C(10) ARRAY_C = (/(I, I=30, 48, 2)/) The values of ARRAYC are the even numbers 30 through 48. The following example shows an array constructor of derived type that uses a structure constructor: TYPE EMPLOYEE INTEGER ID CHARACTER(LEN=30) NAME END TYPE EMPLOYEE TYPE(EMPLOYEE) CC_4T(4) CC_4T = (/EMPLOYEE(2732,"JONES"), EMPLOYEE(0217,"LEE"), & EMPLOYEE(1889,"RYAN"), EMPLOYEE(4339,"EMERSON")/) The following example shows how the RESHAPE intrinsic function is used to create a multidimensional array: E = (/2.3, 4.7, 6.6/) D = RESHAPE(SOURCE = (/3.5,(/2.0,1.0/),E/), SHAPE = (/2,3/)) D is a rank-two array with shape (2,3) containing the following elements: 3.5 1.0 4.7 2.0 2.3 6.6