C Library Functions  - get_type (3)

NAME

get_type(3f) - [M_anything] return array of strings containing type names of arguments (LICENSE:MIT)

CONTENTS

Synopsis
Description
Options
Return
Examples
Author
License

SYNOPSIS

function get_type(anything) result(chars)

    class(*),intent(in)  :: anything
            or
    class(*),intent(in)  :: anything(..)

character(len=:),allocatable :: chars

DESCRIPTION

This function uses polymorphism to allow input arguments of different types. It is used by other procedures that can take many argument types as input options.

OPTIONS

VALUEIN
  input array or scalar to return type of May be of KIND INTEGER(kind=int8), INTEGER(kind=int16), INTEGER(kind=int32), INTEGER(kind=int64), REAL(kind=real32, REAL(kind=real64), REAL(kind=real128), complex, or CHARACTER(len=*)

RETURN

CHARS The returned value is an array of names

EXAMPLES

Sample program

   program demo_get_type
   use M_anything,      only : get_type
   implicit none
   integer :: i
      write(*,*)get_type([(i*i,i=1,10)])
      write(*,*)get_type([11.11,22.22,33.33])
      write(*,*)get_type(’This is a string’)
      write(*,*)get_type(30.0d0)
   end program demo_get_type

Results:

    int32
    real32
    character
    real64

AUTHOR

John S. Urban

LICENSE

    MIT


Nemo Release 3.1 get_type (3) February 23, 2025
Generated by manServer 1.08 from 836ca636-25a8-4556-92eb-56a0d3f961a7 using man macros.