intrinsic_present.f90

来自「linux下编程用 编译软件」· F90 代码 · 共 41 行

F90
41
字号
! Program to test the PRESENT intrinsicprogram intrinsic_present   implicit none   integer a   integer, pointer :: b   integer, dimension(10) :: c   integer, pointer, dimension(:) :: d      if (testvar()) call abort ()   if (.not. testvar(a)) call abort ()   if (testptr()) call abort ()   if (.not. testptr(b)) call abort ()   if (testarray()) call abort ()   if (.not. testarray(c)) call abort ()   if (testparray()) call abort ()   if (.not. testparray(d)) call abort ()   containslogical function testvar (p)   integer, optional :: p   testvar = present(p)end functionlogical function testptr (p)   integer, pointer, optional :: p   testptr = present(p)end functionlogical function testarray (p)   integer, dimension (10), optional :: p   testarray = present(p)end functionlogical function testparray (p)   integer, pointer, dimension(:), optional :: p   testparray = present(p)end functionend program

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?