title: How to call a function internal to a subroutine in a module?
body: <p>I have a module that contains a subroutine which in turn contains a function. I say <code>use themodule</code> in my main program and I can <code>call thesubroutine</code>, but how do I access the function that is contained in the subroutine?</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>module useful
    integer, parameter :: N=2
    double precision, parameter :: xmin=1, xmax=10, pi=3.1415926535898
    double complex :: green(N,N), solution(N), k=(2.0,0.0)
  contains
    subroutine y(n1)
    contains
      function x(n1)
        real :: n1, x
        x=n1*(xmax-xmin)/N
      end function x
    end subroutine y
  end module useful
  </code></pre>