I have this program that I wrote trying to test out if I could define a user inputted function then get Fortran to do summation with it. This is what I did.
program test
real :: a,b,n,k,sum
integer, intent(out) :: func
print *, 'what are the values of a b n k?'
read *, a,b,n,k
print *, 'what is the function?'
read *, func
sum = 0
DO I= 1, 6
x = ((A)+I * ((b-a)/(n)))
sum = sum + func
END DO
print *, sum
end program test
The compiler said this in return:
sh-4.3$ gfortran -std=f95 *.f95 -o main
Newfile.f95:5:28:
integer, intent(out) :: func
1
Error: Symbol at (1) is not a DUMMY variable
Any ideas?