[Fortran] 纯文本查看 复制代码 PROGRAM test
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_BOOL
LOGICAL*1 :: byte_1_logical ! kind of 1-byte
LOGICAL(1) :: kind_1_logical ! kind number is 1
LOGICAL :: default_logical ! default kind
WRITE(*,*) C_BOOL !---> 1-byte
! report the kind nunmbes
WRITE(*,*) KIND(byte_1_logical)
WRITE(*,*) KIND(kind_1_logical)
WRITE(*,*) KIND(default_logical)
! Many compilers support 1-, 2- 4- 8-byte LOGICALs
! kind numbers may be (1,2,3,4) or (1,2,4,8), compiler-time-switch dependent
END PROGRAM test |