# 5.2.15 hdfql_cursor_get_dimension

Part of: [5 Application Programming Interface](5-application-programming-interface.md) › [5.2 Functions](5-2-functions.md)

### Syntax

long long hdfql_cursor_get_dimension(const HDFQL_CURSOR \*_cursor_, int _index_)

### Description

Get the size of a certain dimension (specified by _index_) of the result set stored in a cursor named _cursor_. The size of a certain dimension refers to the result of a [DATA QUERY LANGUAGE (DQL)](6-6-data-query-language-dql.md) or [DATA INTROSPECTION LANGUAGE (DIL)](6-7-data-introspection-language-dil.md) operation redirected into a cursor. The index of the first dimension is zero. If _cursor_ has never been populated or has been initialized or cleared, or _index_ is not between 0 and the value returned by [hdfql_cursor_get_dimension_count](5-2-14-hdfql-cursor-get-dimension-count.md) - 1, an error is returned.

### Parameter(s)

_cursor_ – pointer to a cursor to get the size of one of its dimensions. If the pointer is NULL (in C), the size of a certain dimension of the result set stored in the cursor in use is returned instead. The equivalent of a NULL pointer in C++, Java, Python, C#, Fortran, R, and MATLAB HDFql wrappers is NULL, null, None, null, NULL(), NULL, and NaN, respectively. While in C _cursor_ is mandatory, in C++, Java, Python, C#, Fortran, R, and MATLAB it is optional (when not specified, the size of a certain dimension of the result set stored in the cursor in use is returned instead).

_index_ – integer that specifies the index of the dimension whose size is to be obtained.

### Return

long long – depending on the success in getting the size of a certain dimension of the cursor, it can either be equal to or greater than zero (i.e. the size of the specified dimension) or [HDFQL_ERROR_OUTSIDE_LIMIT](5-1-constants.md#hdfql_error_outside_limit).

### Example(s)

```c
// create an HDF5 dataset named "my_dataset" of data type int of two dimensions (size 5x3) 
hdfql_execute("CREATE DATASET my_dataset AS INT(5, 3)");

// select (i.e. read) data from dataset "my_dataset" and populate cursor in use with it 
hdfql_execute("SELECT FROM my_dataset");

// display size of the first dimension of the result set stored in the cursor in use (should be "Size of first dimension of result set stored in cursor is 5")
printf("Size of first dimension of result set stored in cursor is %lld\n", hdfql_cursor_get_dimension(NULL, 0));

// display size of the second dimension of the result set stored in the cursor in use (should be "Size of second dimension of result set stored in cursor is 3")
printf("Size of second dimension of result set stored in cursor is %lld\n", hdfql_cursor_get_dimension(NULL, 1));
```
