# mco_uda_field_erase
RT

> Remove an optional structure field or vector element.

### Prototype

        MCO_RET mco_uda_field_erase(	/*IN*/ const mco_uda_object_handle_p obj,
                        /*IN*/ unsigned short field_no,
                        /*IN*/ unsigned short index );

### Arguments

obj | The object handle
field_no | The field number (must be between 0 and `struct_info.field_count` - 1)
index | The index of the element in a vector

### Description

Remove an optional structure field or vector element.

### Return Codes

MCO_S_OK | Field successfully freed
MCO_E_UDA_FIELD_NOT_FOUND | Invalid `fieldno` - field not found in this class or struct
MCO_E_UDA_NOT_DYNAMIC | The field is not a vector or optional structure

### Example

        Application snippet:

        int main(int argc, char* argv[])
        {
            MCO_RET rc;
            mco_uda_object_handle_t obj;
            mco_uda_value_t val;
            unsigned short optional_field_no = 1;

            ...

            mco_uda_field_erase(&obj, optional_field_no, 0); /* Free allocated vector */

            ...
        }

### Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a