Interop starts by choosing Fortran kinds that correspond to C-facing data widths. The example models the choice without calling C.

Program

Play the program to choose which integer kind label is selected.

kind_mapping.f90
program kind_mapping_demo
    use iso_c_binding, only: c_int, c_long
    implicit none
    integer :: kind_choice
    integer :: chosen_kind
    character(len=12) :: label

    kind_choice = 
    select case (kind_choice)
        case (1)
            chosen_kind = c_int
            label = 'c_int'
        case (2)
            chosen_kind = c_long
            label = 'c_long'
        case default
            chosen_kind = kind(0)
            label = 'default'
    end select
    print '(A, 1X, I0)', trim(label), chosen_kind
end program kind_mapping_demo
program kind_mapping_demo
    use iso_c_binding, only: c_int, c_long
    implicit none
    integer :: kind_choice
    integer :: chosen_kind
    character(len=12) :: label

    kind_choice = 
    select case (kind_choice)
        case (1)
            chosen_kind = c_int
            label = 'c_int'
        case (2)
            chosen_kind = c_long
            label = 'c_long'
        case default
            chosen_kind = kind(0)
            label = 'default'
    end select
    print '(A, 1X, I0)', trim(label), chosen_kind
end program kind_mapping_demo
program kind_mapping_demo
    use iso_c_binding, only: c_int, c_long
    implicit none
    integer :: kind_choice
    integer :: chosen_kind
    character(len=12) :: label

    kind_choice = 
    select case (kind_choice)
        case (1)
            chosen_kind = c_int
            label = 'c_int'
        case (2)
            chosen_kind = c_long
            label = 'c_long'
        case default
            chosen_kind = kind(0)
            label = 'default'
    end select
    print '(A, 1X, I0)', trim(label), chosen_kind
end program kind_mapping_demo
C kinds `c_int` and `c_long` name interoperable integer kinds.
selection `select case` can centralize the mapping decision.
label plus kind A trace can carry both the human label and the selected kind value.