dynUnique()

Reduces field elements to unique elements and outputs their number.

Synopsis

int dynUnique( <dyn_type> &x );

Parameters

Parameter Meaning
x dynamic field

Return Value

Reduced length of the field, in the event of failure -1.

Errors

A message is issued in the event of incorrect or missing arguments or if there is no variable.

Description

Removes all redundant elements from the dynamic field x and returns their reduced length.

The use of the function dynSortAsc() accelerates the use of the function dynUnique(). If the order of the variables is not a determining factor (the function dynSortAsc() sorts the variables ascending), the function should be used before calling the dynUnique() function.
Note: The dynUnique function is not compatible with parameters of type dyn_atime in an array.

Reduction of the dynamic field ("apple", "pear", "apple") by the redundant third element "apple".

main()
{
   int x;
   dyn_string s;
   s = makeDynString("apple", "pear", "apple");
   x = dynUnique(s);
}     

Assignment

Dynamic fields

Availability

CTRL