fortran 中定义内部函数
001、
[root@localhost test]# cat test01.f90 program test01_fortran implicit none real :: a print *, "Please input an real number: " read *, a print *, test01_fun(a) contains ## 声明内部使用的函数 real function test01_fun(x) ## 定义函数 implicit none real :: x test01_fun = x * x ## 函数返回值是函数名本身 end function test01_fun end program test01_fortran [root@localhost test]# gfortran test01.f90 -Wall -O2 -o kkk [root@localhost test]# ls kkk test01.f90 [root@localhost test]# ./kkk Please input an real number: 5 25.0000000

。

浙公网安备 33010602011771号