Passing allocated C_PTR to Fortran array to C
问题 I'm having trouble with segfaults from accessing an array in C, which is allocated in the Fortran file below. There are a few artefacts of debugging, such as the fact that the file writes don't write anything meaningful and I initialise a variable i that I never use. However, I've found the following: Not initialising i (but still declaring it): no segfault Not opening the file in C: no segfault Not printing HESS (not HESS_COPY ) elsewhere in the code: no segfault Declaring and initialising i