作者laa7352 (Laa)
看板Fortran
标题Re: [问题] 有关 定址阵列 以及 常用副程式之间的问题
时间Mon Jun 29 07:40:55 2009
※ 引述《magaiml (祈)》之铭言:
: program yes
: implicit none
: ......
: logical,allocatable:: trans_all(:,:)
: ......
: open(11,file='read_mode_total.txt')
: ......
: read(11,*)total
: allocate(trans_all(1:total,12))
: ......
: call contrast_test(trans_all,test_result)
: ......
: end program ride
: subroutine contrast_test(trans_all,test_result)
: implicit none
: ......
: end
: 请问我该怎样写
: 在副程式中
: 也能开启trans_all
: test_result也是个定址阵列
: 我想在副程式中以某变数来开启
: 又该如何写?
: 我试过很多种
: 主副都写上定址阵列
: 却无法成功
: 请高手指点
program test_allocate
integer,allocatable :: test(:)
parameter (
n=3)
allocate(test(1:n))
do i=1,n
test(i)=i
enddo
print*, '1',test
call
sub_test(
test,n)
stop
end
subroutine sub_test(
test,n)
integer test
dimension
test(n)
print*, '2',test
return
end
输出结果如下
1 1 2 3
2 1 2 3
不知道有没有解决到你的问题?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.228.150.168
※ 编辑: laa7352 来自: 140.137.32.73 (06/29 10:58)