title: Passing a Fortran int array to C++ by calling C++ function in Fortran
body: <p>I am trying to call a C++ function in a Fortran subroutine. This C++ function is supposed to update an integer array. Here is a non-working code I wrote. What is the issue?</p>
  
  <pre><code>! Fortran function that calls a C++ function.
  
  subroutine my_function()
  
        integer(4) ar(*)
  
        integer(4) get_filled_ar
  
        ! Need correct syntax here.
        ar = get_filled_ar()
  end
  
  
  // C++ function:
  
      extern "C" {
          void get_filled_ar(int *ar){
              ar[0] = 1;
              ar[1] = 10;
              ar[3] = 100;
          }
      }
  </code></pre>