在Fortran

时间:2017-11-25 19:44:39

标签: fortran gfortran

我的IDE是:CodeBlocks 16.01

这是我的代码:

Program Array_To_Procedure

Implicit  none

Integer, dimension (10) :: My_Array

Interface

  Subroutine Fill_Array (a)

    Integer :: i
    Integer, intent ( inout ) :: a (*)

  End subroutine Fill_Array

  Subroutine Print_Array (a)

    Integer :: i
    Integer , intent ( in ) :: a (*)

  End subroutine Print_Array

End interface

  Call Fill_Array ( My_Array )
  Call Print_Array ( My_Array )

End program Array_To_Procedure

Subroutine Fill_Array ( a )

Implicit none

    Integer :: i
    Integer, intent ( inout ) :: a (*)

    Do i = 1 , size( a )

       a(i) = i + 1

    End Do

Return
End subroutine Fill_Array

Subroutine Print_Array ( a )

Implicit none

    Integer :: i
    Integer , intent ( in ) :: a (*)

    Do i = 1 , size( a )

       Write(*,*) a(i)

    End Do

Return
End subroutine Print_Array

我的目的是使用intrinsinc函数size来确定子程序中自动数组的大小。就我而言,在编译过程中我收到了这条消息:

The upper bound in the last dimension must appear in the reference to the assumed size array 'a' |

此代码有什么问题?

0 个答案:

没有答案