# 5.2.58 hdfql_variable_get_dimension_count

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

### Syntax

int hdfql_variable_get_dimension_count(const void \*_variable_)

### Description

Get the number of dimensions of the result set stored in a variable named _variable_. The number of dimensions 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 to the number of dimensions that _variable_ has in the program. If _variable_ has been registered but has never been populated through a redirection operation, the returned number of dimensions is zero.

### Parameter(s)

_variable_ – pointer to a variable whose number of dimensions is to be obtained.

### Return

int – depending on the success in getting the number of dimensions of the variable, it can be equal to or greater than zero (i.e. the number of dimensions), [HDFQL_ERROR_NO_ADDRESS](5-1-constants.md#hdfql_error_no_address), or [HDFQL_ERROR_NOT_REGISTERED](5-1-constants.md#hdfql_error_not_registered).

### 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 number of dimensions of variable "data" (should be "Number of dimensions in variable is 2")
printf("Number of dimensions in variable is %d\n",
hdfql_variable_get_dimension_count(data));
```
