![]() In the previous example, we had two module variables, e and pi. The following example illustrates the concept − When you declare some variable or subroutine as private, it is not available outside the module. However, you can control the accessibility of module code using the private and public attributes. When you compile and execute the above program, it produces the following result −Į raised to the power of 2.0 = 7.38905573Īrea of a circle with radius 7.0 = 153.938049Īccessibility of Variables and Subroutines in a Moduleīy default, all the variables and subroutines in a module is made available to the program that is using the module code, by the use statement. We pride ourselves on producing reliable software with. Since 2006, Approximatrix has produced software supporting scientists and developers available at affordable prices without sacrificing funtionality. Print*, "Area of a circle with radius 7.0 = ", area Approximatrix provides a range of products and services to help individuals and organizations increase productivity while decreasing costs. Print*, "e raised to the power of 2.0 = ", ePowerx The following example demonstrates the concept − The use statement can appear in the main program, or any other subroutine or module which uses the routines or variables declared in a particular module. The variables declared in a module become global variables in any program or routine where the module is used. The variables declared in a module specification part, are global to the module. You can add as many modules as needed, each will be in separate files and compiled separately.Ī module can be used in various different programs.Ī module can be used many times in the same program. Approximatrix provides a range of products and services to help individuals and organizations increase productivity while decreasing costs. 1 The project is maintained by the company Approximatrix, LLC. You can incorporate a module in a program or subroutine by the use statement − Simply Fortran is an Integrated Development Environment (IDE) for FORTRAN 77, Fortran 90, Fortran 95, Fortran 2003 and Fortran 2008. Declaring variables that can be made available within any routines you choose. Defining global data that can be used by more than one routine. Integrated Development Environments (IDE) by Approximatrix. ![]() Modules are used for Packaging subprograms, data and interface blocks. Simply Fortran A modern Fortran development environment for Microsoft Windows, Apple macOS. a contains part for subroutine and function definitions Modules provide you a way of splitting your programs between multiple files. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |