The INTENT statement specifies the treatment dummy arguments.
SyntaxINTENT( intent-spec ) [::] dummy-argsWhere:
intent-spec is one ofIN OUT IN OUT
dummy-args is a comma-separated list of dummy arguments.
The INTENT(IN OUT) attribute specifies that the dummy argument is intended for use both to receive data from and to return data to the invoking procedure. This is the default behavior if no INTENT attribute is specified.
The INTENT(IN) attribute specifies that the dummy argument is intended to receive data from the invoking procedure. The dummy argument's value may not be altered during the execution of the subprogram.
The INTENT(OUT) attribute specifies that the dummy argument is intended to return data to the invoking procedure. The subprogram must provide a value for all INTENT(OUT) arguments. An INTENT(OUT) dummy variable cannot be referenced within the subprogram until it has been assigned a value. If a value is not supplied in the subprogram, the value of the actual argument will become undefined upon the subprograms return.
The INTENT statement must not contain a dummy argument that is a procedure or a pointer.
Examplesubroutine ex (a,b,c,d,e,f) real :: a,b,c intent(in) :: a ! a cannot be assigned a value intent(out) b ! b must be given a value intent(in out) c ! default behavior real,intent(in) :: d ! intent attributes real,intent(out) :: e real,intent(in out) :: f end subroutine ex