夏青虫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

program test
    real, dimension(5) :: x
    integer :: n
    x = (/1., 2., 4., 3., 1./)
    n = maxloc(x) + 1
    print *, n
end
 


a.f90(5): error #6366: The shapes of the array expressions do not conform.   [N]
    n = maxloc(x) + 1
----^
compilation aborted for a.f90 (code 1)
 

因为,maxloc的输出值是数组
即使p是一个一维数组
即使maxloc(p)输出只有一个值
但是你还是不得不定义一个只有一个元素的数组来接收,即
integer i4(1)
i4 = maxloc(p)
posted on 2013-01-21 10:45  夏青虫  阅读(6374)  评论(0编辑  收藏  举报