<INTERFACE Example Program 1>

Program specific_interface_example
  Interface
    Real Function mag( a )
      Real, Intent(In) :: a(:)
    End Function
  End Interface
  Real, Allocatable :: a(:)
  Allocate( A(3) )
  a = [ 1.,2.,3. ]
  Print *, mag(a)
End Program
Real Function mag( a )
  Real, Intent(In) :: a(:)
  mag = Sqrt( Sum( a**2 ) )
End Function mag

■ Execution Results

  3.7416575

<INTERFACE Example Program 2>

Module generic_interface_example
  Interface display
    Module Procedure display_integer, display_real
  End Interface
  Private display_integer, display_real
Contains
  Subroutine display_integer(a)
    Integer, Intent(In) :: a
    Print *, 'Integer',a
  End Subroutine
  Subroutine display_real(a)
    Real, Intent(In) :: a
    Print *, 'Real',a
  End Subroutine
End Module
Program example_program_2
  Use generic_interface_example
  Call display(42)
  Call display(4.25)
End Program

■ Execution Results

 Integer 42
 Real   4.2500000