【发布时间】:2019-07-25 09:22:54
【问题描述】:
我已经用 gfortran 和 AOCC 法兰编译器编译了代码,但是两者都失败了,我做错了什么吗?
program find_sub_indx
implicit none
!decl
character(len =30) :: main_string, sub_string
integer :: index_1 , index_2
logical :: back
!defn
main_string = "this is the main string"
sub_string = "a"
back = .false.
index_1 = INDEX(main_string, sub_string, back) !why does this not work
index_2 = INDEX("this is the main string","a", .false.) !this works why?
print *, "index_1 is " , index_1, index_2
end program find_sub_indx
预期结果:
index_1 is 14 14
实际结果:
index_1 is 0 14
有没有一些学习fortran的标准参考,因为我找不到上面使用的内在函数的正确定义。
【问题讨论】: