> ## Name

> cgGetStateEnumerant - get a state enumerant name and value by index

> ## Synopsis

>     #include <Cg/cg.h>

>     const char * cgGetStateEnumerant( CGstate state, int index, int * value );

> ## Parameters

> state
>   The state from which to retrieve an enumerant name and value.
> index
>   The index for the enumerant in state.
> value
>   Pointer to integer where the enumerant value will be stored.

> ## Return Values

> Returns the null-terminated enumerant name string associated with state at position index. The enumerant value is returned via the value parameter.

> Returns NULL if an error occurs. value will be 0.

> ## Description

> cgGetStateEnumerant allows the application to retrieve the enumerant name and value associated with a CGstate at a specified index location. The number of enumerants assocated with a state can be discovered using cgGetNumStateEnumerants.

> ## Examples

>     int value;
>     char* pName;

>     int nEnums = cgGetNumStateEnumerants(state);

>     for (ii=0; ii<nEnums; ++ii) {
>         pName = cgGetStateEnumerant(state, ii, &value );
>         printf("%i: %s %i\n", ii+1, pName, value);
>     }

> ## Errors

> CG_INVALID_STATE_HANDLE_ERROR is generated if state is not a valid state.

> CG_INVALID_POINTER_ERROR is generated if value is NULL.

> CG_INVALID_PARAMETER_ERROR is generated if index is less than 0 or index is greater than or equal to the number of enumerants associated with state.

> ## History

> cgGetStateEnumerant was introduced in Cg 2.2.

> ## See Also

> cgAddStateEnumerant, cgGetNumStateEnumerants, cgGetStateEnumerantName, cgGetStateEnumerantValue