! ----------------------------- ! Example program ! A simple subroutine ! ----------------------------- program test implicit none real(kind(1.d0)):: x,y x = 5.d0 y = 2.d0 write(*,'("before: x,y=",2f7.2)') x,y call swap(x,y) write(*,'(" after: x,y=",2f7.2)') x,y end program test subroutine swap(a,b) implicit none real(kind(1.d0)):: a,b,tmp tmp = a a = b b = tmp end subroutine swap