Fortran [Fortran] subroutines within the same module

  • Thread starter Thread starter mopen
  • Start date Start date
  • Tags Tags
    Fortran module
AI Thread Summary
In Fortran 90, variables defined within a subroutine are not automatically available to other subroutines, even if they are within the same module. Each subroutine has its own scope, meaning that variables must be explicitly passed through the argument list to be accessible in the calling subroutine. In the provided example, the variable "F" calculated in subroutine "m" will not be available to subroutine "h" unless it is included in the argument list of "m". Understanding variable scope is crucial for effective programming in Fortran 90.
mopen
Messages
2
Reaction score
0
Hi all,

I am working on a Fortran 90 program that has many subroutines within the same module. The question is "are all the variables of a called subroutine are available to the calling subroutine without declaring them in the argument list of the called surboutine"? even though they are within the same module.

for example
****************************************
Module x

Subroutine h
*
*
Call subroutine m (m1,m2,m3)
*
end subroutine h

Subroutine m (m1,m2,m3)
*
*
*
F=*******
end subroutine m

end module x
************************************

so will "F" calculated in subroutine :m" will be available to subroutine "h" without declaring it in the argument list of subroutine "m"?

thanks
 
Technology news on Phys.org
Do you know what is a scope of the variable? (Google if not)
 
Borek said:
Do you know what is a scope of the variable? (Google if not)

Be Nice to people!
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...

Similar threads

Replies
59
Views
11K
Replies
3
Views
2K
Replies
8
Views
4K
Replies
14
Views
4K
Replies
11
Views
2K
Replies
4
Views
2K
Replies
5
Views
3K
Back
Top