INTERFACEs

Example

  PROGRAM interface_example

  ! -- declare interface block :

  INTERFACE
    SUBROUTINE expsum
      INTEGER, INTENT(IN) :: N
      REAL, INTENT(IN) :: K, X
      REAL, INTENT(OUT) :: sum
    ENDSUBROUTINE expsum
  ENDINTERFACE

  REAL :: sum
  ...
  ...
  ! -- call external subroutine :
  CALL expsum(10, 0.5, 0.1, sum)
  ...
  ...
  ENDPROGRAM interface_example


  ! -- define external subroutine :

  SUBROUTINE expsum
    INTEGER, INTENT(IN) :: n
    REAL, INTENT(IN)    :: k, x
    REAL, INTENT(OUT)   :: sum

    sum = 0.0

    DO i = 1, n
      sum = sum + exp(-i*k*x)
    ENDDO
  ENDSUBROUTINE expsum


...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_course_fortran_90/_reml_grp/index.reml
On: 10/2/2003 at 10:33:52
Options: reml2 -i noindex -l long -o html -p multiple