# UDA Vector Functions

> ## Vector Functions

> To get the size (length) of a vector or array:

>         MCO_RET mco_uda_length( const mco_uda_object_handle_p obj,
>                         unsigned short field_no,
>                         /* out */ unsigned short * dimension );

> For a vector, this function might return `MCO_S_NULL_VALUE`, in which case nothing is returned in the dimension argument.

> To allocate or erase elements of a vector of structs (e.g. a declaration similar to “`vector<StructName> fld`” in a `schema`), or to allocate / erase an optional field:

>         MCO_RET mco_uda_field_alloc( mco_uda_object_handle_p obj,
>                         unsigned short field_no,
>                         unsigned short length );

>         MCO_RET mco_uda_field_erase( mco_uda_object_handle_p obj,
>                         unsigned short field_no,
>                         unsigned short index );

> Note that the argument `index` is only used to erase an element of a vector of structs. It is ignored for an optional field.

> Note that `mco_uda_field_erase()` replaces the deprecated function `mco_uda_field_free()`.