073. Use parameters to dimension fixed-size arrays to make a code easier to change#
topic: Arrays
Note
This tip is a draft1.
Use parameters to dimension fixed-size arrays to make a code easier to change, for example
integer, parameter :: n1=3,n2=5 real :: x(n1,n2),y(n1,n2),z(n1,n2)
or
real, dimension(n1,n2) :: x,y,z
Numbers other than 0 or 1 should not appear repeatedly and should be parameters.
Use parameters to dimension fixed-size arrays to make a code easier to change, for example
— FortranTip (@fortrantip) January 4, 2022
integer, parameter :: n1=3,n2=5
real :: x(n1,n2),y(n1,n2),z(n1,n2)
or
real, dimension(n1,n2) :: x,y,z
Numbers other than 0 or 1 should not appear repeatedly and should be parameters.
- 1
From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.