title: Python ctypes with Fortran, integer arrays contains unwanted 0s
body: <p>I am new to using ctypes and I am trying to pass a integer array from Python into Fortran, however, in doing so, I can see that in Fortran, my passed array contains zeros between every value. Can someone please explain what is going on here?</p>
  <p>In my Python program, I am just creating a integer array of dimension 10, and using ctypes I want to pass it into my shared Fortran library:</p>
  <pre><code>import ctypes 
  import numpy as np
  
  f90 = ctypes.CDLL('./ctypes_test.so')
  dim=int(10)
  intarr = np.arange(0,dim,dtype=int)
  intarr_ = intarr.ctypes.data_as(ctypes.POINTER(ctypes.c_int))
  dim_INT = ctypes.c_int(dim)
  f90.integerarray_(intarr_, ctypes.byref(dim_INT))
  </code></pre>
  <p>Now my Fortran program will take in the array along with its dimension and initalize it as an integer array of the given dimension. Then I print the array to see what Fortran reads it as:</p>
  <pre><code>SUBROUTINE integerarray(arr, dim)
      INTEGER :: arr, dim
      DIMENSION :: arr(dim)
      PRINT*, arr
  END
  </code></pre>
  <p>The expected output should be 0, 1, 2, ... 9 as given by the numpy arange function in Python, however I get the following:</p>
  <pre><code>0           0           1           0           2           0           3           0           4           0
  0
  </code></pre>
  <p>As you can see, there are zeros between every element. What is going on?</p>