# Derived-Type Assignment Statements

In derived-type assignment statements, the variable and expression must be of the same derived type. There must be no accessible interface block with defined assignment for objects of this derived type.

The derived-type assignment is performed as if each component of the expression is assigned to the corresponding component of the variable. Pointer assignment is performed for pointer components, and intrinsic assignment is performed for nonpointer components.

## Examples

The following example shows derived-type assignment:

    TYPE DATE
      LOGICAL(1) DAY, MONTH
      INTEGER(2) YEAR
    END TYPE DATE

    TYPE(DATE) TODAY, THIS_WEEK(7)
    TYPE APPOINTMENT
    ...
      TYPE(DATE) APP_DATE
    END TYPE

    TYPE(APPOINTMENT) MEETING

    DO I = 1,7
      CALL GET_DATE(TODAY)
      THIS_WEEK(I) = TODAY
    END DO
    MEETING%APP_DATE = TODAY

Parent topic: Intrinsic Assignment Statements

## See Also

Derived types
Pointer assignments