The REAL statement declares entities having the REAL data type.
SyntaxREAL [kind-selector] [[, attribute-list] ::] entity [, entity] ...Where:
kind-selector is ([KIND=] scalar-int-initialization-expr)
scalar-int-initialization-expr is a scalar INTEGER expression that can be evaluated at compile time.
attribute-list is a comma-separated list from the following attributes:PARAMETER, ALLOCATABLE, DIMENSION(array-spec), EXTERNAL, INTENT(IN) or INTENT(OUT) or INTENT(IN OUT), PUBLIC or PRIVATE, INTRINSIC, OPTIONAL, POINTER, SAVE, TARGET, VOLATILE, DLL_EXPORT or DLL_IMPORT or ML_EXTERNAL.
entity isentity-name [(array-spec)] [=initialization-expr] or func-name [(array-spec)]
array-spec is an array specification.
initialization-expr is an expression that can be evaluated at compile time.
entity-name is the name of an entity being declared.
func-name is the name of a function being declared.
func-name must be the name of an external, intrinsic, or statement function, or a function dummy procedure.
The =initialization-expr must appear if the statement contains a PARAMETER attribute.
If =initialization-expr appears, a double colon must appear before the list of entities. Each entity has the SAVE attribute, unless it is in a named common block.
The =initialization-expr must not appear if entity-name is a dummy argument, a function result, an object in a named common block unless the type declaration is in a block data program unit, an object in blank common, an allocatable array, a pointer, an external name, an intrinsic name, or an automatic object.
If an array or function with an array result is declared with the POINTER attribute, it must have a deferred shape.
If an array is declared with the ALLOCATABLE attribute, it must have a deferred shape.
If an array or function with an array result does not have the POINTER or the ALLOCATABLE attribute, it must be specified with an explicit shape.
If the POINTER attribute is specified, the TARGET, INTENT, EXTERNAL, or INTRINSIC attributes must not be specified.
If the TARGET attribute is specified, the POINTER, EXTERNAL, INTRINSIC, or PARAMETER attributes must not be specified.
The PARAMETER attribute cannot be specified for dummy arguments, pointers, allocatable arrays, functions, or objects in a common block.
The INTENT(IN), INTENT(OUT), INTENT(IN OUT), and OPTIONAL attributes can be specified only for dummy arguments.
An entity may not have the PUBLIC attribute if its type has the PRIVATE attribute.
The SAVE attribute must not be specified for an object that is in a common block, a dummy argument, a procedure, a function result, or an automatic data object.
An entity must not have the EXTERNAL or INTRINSIC attribute specified unless it is a function.
A subprogram must not have the EXTERNAL attribute if it has the INTRINSIC attribute.
An entity having the ALLOCATABLE attribute cannot be a dummy argument or a function result.
An array must not have both the ALLOCATABLE attribute and the POINTER attribute.
If an entity has the VOLATILE attribute, it cannot have the PARAMETER, INTRINSIC, EXTERNAL, or INTENT(IN) attributes.
An entity may not be given the same attribute more than once in a scoping unit.
Examplereal :: a,b(2,4) ! explicit shape real,dimension(2) :: c=/1.,2./ ! has save attribute real,pointer :: d(:) ! deferred shapes real,allocatable :: e(:) real,parameter :: f=3 ! must be initialized