Tutorial by Examples

Module is a collection of type declarations, data declarations and procedures. The basic syntax is: module module_name use other_module_being_used ! The use of implicit none here will set it for the scope of the module. ! Therefore, it is not required (although considered good practice...
To access entities declared in a module from another program unit (module, procedure or program), the module must be used with the use statement. module shared_data implicit none integer :: iarray(4) = [1, 2, 3, 4] real :: rarray(4) = [1., 2., 3., 4.] end module program test !...
Fortran 2003 introduced intrinsic modules which provide access to special named constants, derived types and module procedures. There are now five standard intrinsic modules: ISO_C_Binding; supporting C interoperability; ISO_Fortran_env; detailing the Fortran environment; IEEE_Exceptions, IEEE_...
Accessibility of symbols declared in a module can be controlled using private and public attributes and statement. Syntax of the statement form: !all symbols declared in the module are private by default private !all symbols declared in the module are public by default public !symbols in t...
As well as allowing module entities to have access control (being public or private) modules entities may also have the protect attribute. A public protected entity may be use associated, but the used entity is subject to restrictions on its use. module mod integer, public, protected :: i=1 en...

Page 1 of 1