program main
use iso_c_binding
implicit none
interface print_number
procedure:: print_number_real, print_number_c_float
end interface
call print_number(1.0)
contains
subroutine print_number_real(a)
real:: a
print*, a
end subroutine
subroutine print_number_c_float(a)
real(c_float):: a
print*, a
end subroutine
end program
楚香饭 发表于 2025-7-17 08:40
本质上都是 float32,32位浮点。
重载看他本质上的类型,而不是看他取了个什么别名。 ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |