N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## qsort

Syntax

    #include <string.h>
    void qsort (void *base, size_t num, size_t width, int (*compare)(const void *, const void *));

Arguments

- base is the pointer to an array
- num is the number of elements in the array
- width is the size of one element in the array (byte unit)
- compare is a pointer to a comparison function created by the user

Return Value
None
Explanation
It sort the array pointed to by base in ascending order with respect to the comparison function. The compare argument points to a comparison function created by the user:

    int compare ((type *) elem1, (type *) elem2);

Note that (type *) is an optional type. The value returned by the comparison function is less than zero, equal to zero, or greater than zero depending on whether elem1 is less than, equal to, or greater than elem2.
Note
This standard function comes with NuSystem.

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998