# NUM_IMAGES

Transformational Intrinsic Function (Generic): Returns the number of images on the current or specified team.

result = NUM_IMAGES()

result = NUM_IMAGES (team)result = NUM_IMAGES (team_number)

team | (Input) Must be a scalar of type TEAM_TYPE defined in the intrinsic module ISO_FORTRAN_ENV. Fortran 2018 requires the team specified by team to be the current or an ancestor team. ifort accepts any team variable defined by a FORM TEAM statement, and will diagnose use of a team variable which does not describe the current or an ancestor team with a run-time message when the check standard-behavior compiler option is selected.
team_number | (Input) Must be an integer scalar. It must identify the initial team (-1), or a vaild team number of a team created by the same execution of the FORM TEAM statement that created the current team executing the function reference (a sibling of the current team).

## Results

The result type is default integer. The result is the number of images on the current or specified team.

If neither team nor team_number are specified, the team is the current team. team and team_number may not both be specified.

You can specify a compiler option or environment variable to modify the number of images. If both are specified, the environment variable setting overrides the compiler option setting.

A compiler option must be specified to enable coarrays. If it is not specified and you use this intrinsic function, an error occurs.

## Example

In the following example, image 1 is used to read data. The other images then copy the data:

    REAL :: R[*]

    IF (THIS_IMAGE()==1) THEN
       READ (7,*) R
       DO I = 2, NUM_IMAGES()
          R[I] = R
       END DO
    END IF
    SYNC ALL

Parent topic: M to N

## See Also

FORM TEAM