224. Ways of declaring character variables#
topic: Data types
Note
This tip is a draft1.
The code
character(5) :: a, b, c*3
declares two character variables of length 5 and one of length 3, but clearer is
character(5) :: a, b character(3) :: c
or
character(len=5) :: a, b character(len=3) :: c
or
character :: a5, b5, c*3
The code
— FortranTip (@fortrantip) May 25, 2022
character(5) :: a, b, c*3
declares two character variables of length 5 and one of length 3, but clearer is
character(5) :: a, b
character(3) :: c
or
character(len=5) :: a, b
character(len=3) :: c
or
character :: a*5, b*5, c*3
- 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.