I want to assign the return values of an array functions of size N to N scalars. In the simplest case, the array is of size 2 like shown below:
PROGRAM ARRAY_FUNCTIONS
IMPLICIT NONE
REAL :: x_input , y_input
REAL :: x_output, y_output
REAL, DIMENSION(0:1) :: a_dummy
x_input = 1.0
y_input = 2.0
a_dummy = Test_Array(x_input, y_input)
x_output = a_dummy(0)
y_output = a_dummy(1)
CONTAINS
FUNCTION Test_Array(x1,y1)
REAL, DIMENSION(0:1) :: Test_Array
Test_Array(0) = 2*x1
Test_Array(1) = 2*x1
END FUNCTION Test_Array
END PROGRAM ARRAY_FUNCTIONS
Is there a way around declaring a dummy variable "a_dummy" and assigning my scalars "x_input" and "y_input" through that variable?