Next: , Previous: , Up: Variables   [Contents][Index]


2.5.2 Variable Type and Width

A variable’s type and width are the type and width of its values (see Values).

Function: enum val_type var_get_type (const struct variable *var)

Returns the type of variable var.

Function: int var_get_width (const struct variable *var)

Returns the width of variable var.

Function: void var_set_width (struct variable *var, int width)

Sets the width of variable var to width. The width of a variable should not normally be changed after the variable is created, so this function is rarely used. This function cannot be applied to a variable that is part of a dictionary.

Function: bool var_is_numeric (const struct variable *var)

Returns true if var is a numeric variable, false otherwise.

Function: bool var_is_alpha (const struct variable *var)

Returns true if var is an alphanumeric (string) variable, false otherwise.