IS_CONTIGUOUS (The GNU Fortran Compiler)

### 8.162 `IS_CONTIGUOUS` — Test whether an array is contiguous ¶

Synopsis:

  `RESULT = IS_CONTIGUOUS(ARRAY)`

Description:

  `IS_CONTIGUOUS` tests whether an array is contiguous.

Class:

  Inquiry function

Arguments:

  ARRAY | Shall be an array of any type.

Return value:

  Returns a `LOGICAL` of the default kind, which is `.TRUE.` if ARRAY is contiguous and false otherwise.

Example:

      program test
        integer :: a(10)
        a = [1,2,3,4,5,6,7,8,9,10]
        call sub (a)      ! every element, is contiguous
        call sub (a(::2)) ! every other element, is noncontiguous
      contains
        subroutine sub (x)
          integer :: x(:)
          if (is_contiguous (x)) then
            write (*,*) 'X is contiguous'
          else
            write (*,*) 'X is not contiguous'
          end if
        end subroutine sub
      end program test

Standard:

  Fortran 2008 and later