# MATHCompareFunc

## C Specification

      #include <nitro/math/qsort.h>

      typedef s32 (*MATHCompareFunc) (void *elem1, void *elem2);

## Arguments

elem1 | Pointer to Element 1.
elem2 | Pointer to Element 2.

## Return Values

Returns a positive number when Element 1 should precede Element 2.
Returns a negative number when Element 1 should follow Element 2.

Be sure to return 0 if the comparison shows Element 1 is equal to Element 2.

## Description

The type of the comparison function that is passed as a comparison function for sorting with `MATH_QSort`. If a positive number is returned, the first element will be arranged further back in the array. If a negative is returned, the second element will be arranged further back in the array.

## See Also

MATH_QSort

## Revision History

07/19/2006 Revised the description of return values.
04/21/2006 Added a description of return values.
04/12/2005 Initial version.

CONFIDENTIAL