Created
November 13, 2017 11:05
-
-
Save zrhans/7433a1b82d4d2eab6ec1978ef64833fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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