! Module module my_modules implicit none type point real :: x,y,z end type point interface assignment (=) module procedure array_to_point end interface contains subroutine array_to_point(some_point, some_array) type(point), intent(out) :: some_point real, intent(in) :: some_array(3) some_point%x = some_array(1) some_point%y = some_array(2) some_point%z = some_array(3) end subroutine array_to_point end module my_modules ! Program program main use my_modules implicit none type(point) :: p real :: a(3) a = (/1.,2.,3./) p = a ! Uses the assignment operator print*, p a = 20.0 call array_to_point(p,a) ! Uses the subroutine directly print*, p end program main