LF Fortran 95

Derived Type Constructors

A structure constructor is an unnamed structure.


type-name ( expr-list )

type-name is the name of the derived type.

expr-list is a list of expressions.

Each expression in expr-list must agree in number and order with the corresponding components of the derived type. Where necessary, intrinsic type conversions are performed. For non-pointer components, the shape of the expression must agree with that of the component.

type mytype ! derived-type definition integer :: i,j character(len=40) :: string end type mytype type (mytype) :: a ! derived-type declaration a = mytype (4, 5.0*2.3, 'abcdefg')

In this example, the second expression in the structure constructor is converted to type default INTEGER when the assignment is made.