program main
implicit none
real,external::vvmat(2,2)
real dh0(2,2),v1(2)
integer n
n=2
dh0=vvmat(v1,v1,n)
end program main
function vvmat(a,b,n)
implicit none
integer n,i,j
real(kind=dp) a(n),b(n),vvmat(n,n)
do i=1,n
do j=1,n
vvmat(i,j)=a(i)*b(j)
end do
end do
end function vvmat
1.png (47.89 KB, 下载次数: 255)
real,external::vvmat
li913 发表于 2021-8-11 17:33
函数返回值为数组,需要interface. 看《interface功能详解》http://fcode.cn/guide-61-1.html ...
necrohan 发表于 2021-8-12 08:12
用参数传递返回值吧,比较简单
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |