# CFI_deallocate

C function prototype: Deallocates memory for an object described by a C descriptor.

    int CFI_deallocate (CFI_cdesc_t *dv);

Formal Parameters:

dv | The address of a C descriptor describing the object. It must have been allocated using the same mechanism as the Fortran ALLOCATE statement. If the object is a pointer, it must be associated with a target satisfying the conditions for successful deallocation by the Fortran DEALLOCATE statement.

## Description

Successful execution of CFI_deallocate deallocates memory for the object using the same mechanism as the Fortran DEALLOCATE statement, and the `base_addr` member of the C descriptor becomes a null pointer.

If an error is detected, the C descriptor is not modified.

## Result Value

The result is an error indicator.

## Example

If dv is the address of a C descriptor for the Fortran array A declared as follows:

    REAL, ALLOCATABLE :: A(:, :)

and the array is allocated, the following code deallocates it:

    int ind;
    ind = CFI_deallocate(dv);

Parent topic: C to D

## See Also

ALLOCATE
DEALLOCATE
C Structures Typedefs and Macros for interoperability
Interoperating with arguments using C descriptors