Skip to content

Instantly share code, notes, and snippets.

@zrhans
Last active November 5, 2022 01:19
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/e53a9da55b0ec556978fefa43d68e70d to your computer and use it in GitHub Desktop.
Save zrhans/e53a9da55b0ec556978fefa43d68e70d to your computer and use it in GitHub Desktop.
program mainprog
implicit none
real :: a, b
a = 2.0
b = 3.0
Print *, "Antes de chamar troca"
Print *, "a = ", a
Print *, "b = ", b
call troca(a, b)
Print *, "Depois de chamar troca"
Print *, "a = ", a
Print *, "b = ", b
contains
subroutine troca(x, y)
real :: x, y, temp
temp = x
x = y
y = temp
end subroutine troca
end program mainprog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment