# 5.2.59 hdfql_variable_get_dimension

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

### Syntax

long long hdfql_variable_get_dimension(const void \*_variable_, int _index_)

### Description

Get the size of a certain dimension (specified by _index_) of the result set stored in a variable named _variable_. 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 memory – and not the size of a certain dimension that _variable_ has in the program. The index of the first dimension is zero. If _variable_ has never been registered or populated or has been unregistered, or _index_ is not between 0 and the value returned by [hdfql_variable_get_dimension_count](5-2-58-hdfql-variable-get-dimension-count.md) - 1, an error is returned.

### Parameter(s)

_variable_ – pointer to a variable to get the size of one of its dimensions.

_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 variable, it can be equal to or greater than zero (i.e. the size of the specified dimension), [HDFQL_ERROR_NO_ADDRESS](5-1-constants.md#hdfql_error_no_address), [HDFQL_ERROR_NOT_REGISTERED](5-1-constants.md#hdfql_error_not_registered), or [HDFQL_ERROR_OUTSIDE_LIMIT](5-1-constants.md#hdfql_error_outside_limit).

### Example(s)

```c
// declare variables 
char script[1024];
int data[5][3];

// 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)");

// register variable "data" for subsequent use (by HDFql) 
hdfql_variable_register(data);

// prepare script to select (i.e. read) data from dataset "my_dataset" and populate variable "data" with it
sprintf(script, "SELECT FROM my_dataset INTO MEMORY %d", hdfql_variable_get_number(data));

// execute script 
hdfql_execute(script);

// display size of the first dimension of variable "data" (should be "Size of first dimension of variable is 5")
printf("Size of first dimension of variable is %lld\n", hdfql_variable_get_dimension(data, 0));

// display size of the second dimension of variable "data" (should be "Size of second dimension of variable is 3")
printf("Size of second dimension of variable is %lld\n", hdfql_variable_get_dimension(data, 1));
```
