# Manipulating array descriptors from C?

**URL:** <https://fortran-lang.discourse.group/t/manipulating-array-descriptors-from-c/6794>\
**Category:** Help\
**Created:** [November 14, 2023, 11:04am UTC](https://fortran-lang.discourse.group/t/manipulating-array-descriptors-from-c/6794 "2023-11-14T11:04:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [November 14, 2023, 12:57pm UTC](https://fortran-lang.discourse.group/t/manipulating-array-descriptors-from-c/6794/3 "2023-11-14T12:57:18Z")

</div>

See this answer:

> [@Issues interfacing between C++ and Fortran](https://fortran-lang.discourse.group/t/issues-interfacing-between-c-and-fortran/456/13):
>
> Hi @ivanpribec, I had a look at the code from your original post using the C descriptor and I think I’ve got it working. I think you are right that the C descriptor does not survive the initial call. From the interpretation document 18-007r1, section 18.8 Restrictions on lifetimes, paragraph 2: A C descriptor whose address is a formal parameter that corresponds to a Fortran dummy argument becomes undefined on return from a call to the function from Fortran. If the dummy argument does not have…

You can store a copy of the `base_addr` in your struct, but you’re still at risk of your C struct becoming invalid due to a `deallocate` statement or the end of a scope, or the creation of an array temporary. Essentially you can’t have two sources of truth as one is bound to become corrupt at some point.

---

_[View the full topic](https://fortran-lang.discourse.group/t/manipulating-array-descriptors-from-c/6794)._
