I am trying to create a program that writes me the value of a function according to the values that exist in a vector. Is there any way to pass each value of the vector to the function in a similar way to this?:
program prueba
real(kind=4),dimension(2) :: vector
vector(1)=3
vector(2)=4
print *, func(vector)
end program
FUNCTION func(x,y)
func=x+y
END FUNCTION func
I know that the correct thing would be to put func(vector(1),vector(2))
but I want the program to be general for any function of dimension N.