Different CHARACTER lengths (3/4) in array constructor, how to trim strings - fortran

我们两清 提交于 2019-11-30 21:05:17
High Performance Mark

gfortran is preventing you from writing non-standard code; it's the language standard which forbids it, not the implementation.

If you initialise a character array as you have done then all the entries must have the same length. In your case you would have to pad each shorter entry with enough spaces to make them all equally long.

The alternative would be to insert the entries when program execution starts. If you write something like vars_ncep(1) = 'air' then the additional characters will be set to spaces, the compiler will take care of that for you. This however, would mean that your array could not be a parameter.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!