c c c
```      program extern
c
c   Example using EXTERNAL and INTRINSIC statements
c   passing
c
c
c     John Mahaffy 12/17/96
c
implicit none
real func1, func2, feval
real a
c
external func1, func2, sub1
intrinsic abs
c
a = feval(func1,-1.0)
print *, 'feval(func1,-1.0) = ', a
a = feval(func2,-1.0)
print *, 'feval(func2,-1.0) = ', a
a = feval(abs,-1.0)
print *, 'feval(abs,-1.0) = ', a
call seval (a,sub1,func1,-1.)
print *, 'seval(a,sub1,func1,-1.) => a = ' ,a
stop
end
c
real function feval(func,val)
c
c   Obtain a value based on a passed function
c
c     John Mahaffy 12/17/96
c
implicit none
real func, val
feval = func(val)
return
end
c
function func1(x)
implicit none
real func1,x
func1 = x
return
end
c
function func2(x)
implicit none
real func2,x
func2 = x**2
return
c
end function func2
c
c
subroutine seval(out, subarg, funcarg, val)
c
c   Obtain an output value based on a passed function  and subroutine
c
c     John Mahaffy 12/17/96
c
implicit none
real out, val, funcarg
external funcarg
call subarg(out,funcarg,val)
return
end
c
subroutine sub1(y,func,x)
implicit none
real x,y,func
y=func(x)
return
end
c```
c c