Fortran: Initialization of allocatable array with another array

50 Views Asked by At

I read a Fortran code :

  program t
    real :: x(5)  =[1.,-2.,3.,-4.,5.]
    real,allocatable :: y(:)
    y = x
    ...

For me the normal way is allocate(y,source=x)

I'm surprised that it works, both compile with ifort or gfortran

Is there something new in the fortran standards that I'm not aware of?

0

There are 0 best solutions below