c c
c
program test
implicit none
real a,b,c,d,e
data a,b,c,d /1.,2.,3.,4./
c
c John Mahaffy 11/20/96
c
c Demonstrate use of CONTAINS statement and
c internal procedures
e = func(a,b)
call intsub
write(*,*) 'a =', a, ', b = ', b, ', c =', c
write(*,*) 'd =', d, ', e = ', e
c
contains
c
c
function func(x,y)
real x,y,func
c
c Note that "func" knows the value of c assigned above
c
func = x + y + c
return
end function func
c
subroutine intsub
c
c By declaring the type of "d" below, I also implicitly
c tell the compiler that I want to reserve the name "d"
c for local use in "intsub". The value of "d" in the
c main program is not affected. I don't declare a type
c for "c" locally, so it is the same varable used in the
c main program.
c
real d
d = 20
c = b*c
c
end subroutine intsub
c
c
end
c
c
c