Fortran PARAMETER variable initialized from input

前端 未结 3 1953
谎友^
谎友^ 2020-12-11 22:01

In Fortran, is the PARAMETER attribute set at runtime or compilation time? I was wondering if I can pass in the size the of the array at run time and have this

3条回答
  •  既然无缘
    2020-12-11 22:47

    The value of a parameter is set at compile time.

    A declaration such as

    integer, parameter :: number_of_widgets = numwidge
    

    requires that numwidge be known at compile time, indeed known before it is encountered on the rhs of the declaration.

提交回复
热议问题