fortran的allocate的用法这段代码怎么有点不对function igl(lxyz,ig,l) implicit noneinteger,parameter::integ=4integer igl,lxyz(3),ig(3),l,i integer,allocatable::rex(*),rey(*),rez(*),ref(*)allocate(rex(l))allocate(rey(l))allocate(rez(l))allo
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/04 12:54:05
![fortran的allocate的用法这段代码怎么有点不对function igl(lxyz,ig,l) implicit noneinteger,parameter::integ=4integer igl,lxyz(3),ig(3),l,i integer,allocatable::rex(*),rey(*),rez(*),ref(*)allocate(rex(l))allocate(rey(l))allocate(rez(l))allo](/uploads/image/z/11543651-35-1.jpg?t=fortran%E7%9A%84allocate%E7%9A%84%E7%94%A8%E6%B3%95%E8%BF%99%E6%AE%B5%E4%BB%A3%E7%A0%81%E6%80%8E%E4%B9%88%E6%9C%89%E7%82%B9%E4%B8%8D%E5%AF%B9function+igl%28lxyz%2Cig%2Cl%29+implicit+noneinteger%2Cparameter%3A%3Ainteg%3D4integer+igl%2Clxyz%283%29%2Cig%283%29%2Cl%2Ci+integer%2Callocatable%3A%3Arex%28%2A%29%2Crey%28%2A%29%2Crez%28%2A%29%2Cref%28%2A%29allocate%28rex%28l%29%29allocate%28rey%28l%29%29allocate%28rez%28l%29%29allo)
fortran的allocate的用法这段代码怎么有点不对function igl(lxyz,ig,l) implicit noneinteger,parameter::integ=4integer igl,lxyz(3),ig(3),l,i integer,allocatable::rex(*),rey(*),rez(*),ref(*)allocate(rex(l))allocate(rey(l))allocate(rez(l))allo
fortran的allocate的用法
这段代码怎么有点不对
function igl(lxyz,ig,l)
implicit none
integer,parameter::integ=4
integer igl,lxyz(3),ig(3),l,i
integer,allocatable::rex(*),rey(*),rez(*),ref(*)
allocate(rex(l))
allocate(rey(l))
allocate(rez(l))
allocate(ref(3*l))
do i=1,3*l
ref(i)=0 initialize it to zero
enddo
.
还有后续的代码,提示是带allocate的所有行都有问题,我大概知道function里面好像根本不用声明allocate,直接声明integer rex(l)就可以.是不是这样啊.
fortran的allocate的用法这段代码怎么有点不对function igl(lxyz,ig,l) implicit noneinteger,parameter::integ=4integer igl,lxyz(3),ig(3),l,i integer,allocatable::rex(*),rey(*),rez(*),ref(*)allocate(rex(l))allocate(rey(l))allocate(rez(l))allo
integer,allocatable::rex(*),rey(*),rez(*),ref(*)
改为
integer,allocatable::rex(:),rey(:),rez(:),ref(:)
如果数组的大小出现在虚参中,可以不用 allocatable,直接 integer rex(I),前提是 I 是虚参.