keeping array limits in fortran during subroutine call

后端 未结 3 470
执笔经年
执笔经年 2021-01-19 00:56

I have the following program

module test
contains
   subroutine foo()
      integer, allocatable :: a(:)
      allocate(a(-5:5))
      call bar(a)
      prin         


        
3条回答
  •  野的像风
    2021-01-19 01:37

    How can I instruct the compiler that, within the bar routine, the numbering of the a array must be the same as in the caller ?

    Not sure but according to the standard you can specify the lower bound for an assumed-shape array.

    subroutine bar(a)
          integer, intent(out) :: a(-5:)
    

提交回复
热议问题