Skip to content

Instantly share code, notes, and snippets.

@zrhans
Created November 13, 2017 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrhans/7433a1b82d4d2eab6ec1978ef64833fe to your computer and use it in GitHub Desktop.
Save zrhans/7433a1b82d4d2eab6ec1978ef64833fe to your computer and use it in GitHub Desktop.
program calling_func
implicit none
real :: a, b
a = 2.0
b = 3.0
Print *, "Before calling swap"
Print *, "a = ", a
Print *, "b = ", b
call swap(a, b)
Print *, "After calling swap"
Print *, "a = ", a
Print *, "b = ", b
end program calling_func
subroutine swap(x, y)
implicit none
real :: x, y, temp
temp = x
x = y
y = temp
end subroutine swap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment