Sort

AnalysisLibErrType Sort (double inputArray[], int numberOfElements, int direction, double outputArray[]);

Purpose

Sorts the input array in ascending or descending order.

Sort can perform the operation in place; that is, input and output arrays can be the same.

Example

/* Generate a random array of numbers and sort them in ascending order. */
double x[200], y[200];
int n;
int dir;
n = 200;
dir = 0;
Uniform (n, 17, x);
Sort (x, n, dir, y);

Parameters

Input
Name Type Description
inputArray double-precision array Input array that contains the values to sort.
numberOfElements integer Number of elements to sort.
direction integer Specifies whether to sort the elements in ascending or descending order.

Default Value: 0—ascending order

Valid Values:
0—ascending order
nonzero—descending order

Output
Name Type Description
outputArray double-precision array Sorted array.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.