Return all the values of an Associative Array
Array_Type assoc_get_keys (Assoc_Type a)
This function returns all the values in the associative array
a as an array of proper type. If the associative array
contains no keys, an empty array will be returned.
Suppose that a is an associative array of type
Integer_Type, i.e., it was created via
variable a = Assoc_Type[Integer_Type];
The the following may be used to print the values of the array in
ascending order:
static define int_sort_fun (x, y)
{
return sign (x - y);
}
define sort_and_print_values (a)
{
variable i, v;
v = assoc_get_values (a);
i = array_sort (v, &int_sort_fun);
v = v[i];
foreach (v)
{
variable vi = ();
() = fprintf (stdout, "%d\n", vi);
}
}
|