I want to create a function FUN(x) which takes x as an argument which is complex variable, but I didn't make it. I searched but hadn't found any useful information. Can anybody help me?
program Console2
IMPLICIT REAL *8 (A-H,O-W)
external FUN
complex:: b
b=(2,2)
print*,FUN(b)
end program Console2
FUNCTION FUN (x)
IMPLICIT REAL *8 (A-H,O-W)
complex, intent(in) :: x
complex :: a
a=(1,2)
FUN=x+a
RETURN
END
funto be complex you have to declare it to be complex, rather thanreal*8. Putcomplex funin both your main program and the function.