Posts

Showing posts with the label fortran arrays

Arrays in Fortran

Image
There are many type of declarations in Fortran referring to arrays that we should be aware of, before attempting to use any of them. Explicit-shape Arrays with constant bounds Explicit-shape arrays with constant bounds are non-dummy arrays whose shape is explicitly specified. They may be declared in the main program or inside the procedure body. They do not appear in the argument list of a procedure and they may be initialized in their type declaration statements. Here are two examples: integer, parameter :: n = 20 !non-initialized two dimensional array real, dimension(n,n) :: arr !initialized with lower bound -3 real, dimension(-3:5) :: arr2 = 8.0 Dummy Arrays Dummy arrays are arrays that appear in the argument list of procedures. No memory is allocated, because they should be allocated externally prior to be used. There are three types: Explicit-shape dummy arrays ' dimensions are explicitly declared by other arguments in the procedure's argument list. All the advanced featur...