Direct Initialization of ALLOCATABLE Variable

68 Views Asked by At

Can I Directly Initialize a Derived type that has allocatable variable in it.

In the following Program, I want to initialize the derived type variable "Zero" to contain 0. Is it possible?

PROGRAM testProgram

TYPE IntegerType
INTEGER, ALLOCATABLE :: Num
END TYPE IntegerType

TYPE(IntegerType), PARAMETER :: Zero = IntegerType(ALLOCATE(0))


print*, Zero

END PROGRAM testProgram
0

There are 0 best solutions below