Array declaration in FORTRAN for beginners

前端 未结 2 1669
没有蜡笔的小新
没有蜡笔的小新 2021-01-20 18:56

This is a beginners question but I haven\'t found a comprehensive answer.

What are the differences (if any) of the following declarations?

CHARACTER(         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-20 19:33

    Three of those declare a character variable that holds a string of 5 characters. Two of them declare an array of 5 characters, each capable of holding a single character.

    The two that declare arrays of 5 elements will work the same way to declare an array of 5 reals. The three that declare characters of length 5 have no analog in other variable types. The specific syntax of a subset of those three will compile, however, but will be used to select different kinds of reals, rather than denoting a character length.

提交回复
热议问题