# mco_uda_length
RT

> Return the size (length) of a vector or array.

### Prototype

        MCO_RET mco_uda_length(	/*IN*/ mco_uda_object_handle_t * obj,
                      /*IN*/ unsigned short field_no,
                      /*OUT*/ unsigned short * dimension);

### Arguments

obj | The address of a `mco_uda_object_handle_t` struct containing the UDA object
field_no | The field number (must be between 0 to `struct_info.field_count` - 1)
dimension | The address of a variable to receive the length (number of elements) of the vector or array

### Description

> Return the length (number of elements) of the vector or array field.

### Return Codes

MCO_S_OK | The cursor was returned successfully
MCO_E_UDA_FIELD_NOT_FOUND | Invalid field_no
MCO_E_UDA_SCALAR | The field is not a vector or array

### Example

        Application snippet:

        int main(int argc, char** argv)
        {
            MCO_RET rc;
            mco_db_h db;
            mco_trans_h t;
            mco_cursor_t cursor;
            unsigned short field_no = 1;
            unsigned short struct_no = 1;
            unsigned short index_no = 5;
            unsigned short length;
            ...

            rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t);
            if ( MCO_S_OK == rc )
            {
                rc = mco_uda_cursor(t, struct_no, index_no, &cursor);
                for ( ; rc == MCO_S_OK; rc = mco_cursor_next(t, &cursor))
                {
                    mco_uda_object_handle_t obj;
                    /* get object handle */
                    mco_uda_length(&obj, field_no, &length);

                    ...
                }
                rc = mco_trans_rollback(t);
            }
        }

### Files

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