title: Passing allocatable array from fortran to C and malloc it
body: <p>I am converting some of our Fortran library code into C so that we finally have C functions with Fortran wrappers around it. We are using Fortran 95.</p>
  
  <p>What is the preferred way to handle allocatable arrays?</p>
  
  <ol>
  <li><p>Can I pass an allocatable array to a C function and malloc it inside the C function?
  (The C function knows the size to be malloc'ed)</p></li>
  <li><p>In the fortran program, can I deallocate something that was malloced in a C function?
  So finally either the client fortran application deallocates the array or is required to call a C function that frees the memory.</p></li>
  </ol>
  
  <p>A small example or a link to one would be highly appreciated.</p>