【发布时间】:2013-12-18 22:43:06
【问题描述】:
给出错误消息的版本
program hello
integer a(9)
integer index; ! note no dimension here
a=(/1, 3, 4, 5, 6, 7, 8, 9, 10/)
index = MINLOC(a, MASK=(a > 5))
Print *, index
end program Hello
错误信息
main.f95:5.3:
索引 = MINLOC(a, MASK=(a > 5)) 1 错误:在 (1) 处的分配中不相容的等级 0 和 1
工作版
program hello
integer a(9)
integer index(1) ! note dimension 1 here which looks redundant at first
a=(/1, 3, 4, 5, 6, 7, 8, 9, 10/)
index = MINLOC(a, MASK=(a > 5))
Print *, index
end program Hello
搜索
Here我可以找到相关的讨论,但我觉得它不够冗长,无法让我理解其中的区别。
【问题讨论】: