NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
ex_ArraySort.nxc

This is an example of how to use the ArraySort function.

task main()
{
int data[40];
int tmp[];
for (int i = 0; i < 40; i++)
data[i] = rand();
ArraySort(tmp, data, NA, NA); // start at 0 and go to length(data);
TextOut(0, LCD_LINE1, "Min value = ");
NumOut(0, LCD_LINE2, tmp[0]);
TextOut(0, LCD_LINE3, "Max value = ");
NumOut(0, LCD_LINE4, tmp[39]);
TextOut(0, LCD_LINE5, "Min value = ");
NumOut(0, LCD_LINE6, ArrayMin(data, NA, NA));
TextOut(0, LCD_LINE7, "Max value = ");
NumOut(0, LCD_LINE8, ArrayMax(data, NA, NA));
}