Sorting integers (C version)
Write a comparison function
int cmp(const void *px, const void *py)
{
int x = *(int *) px;
int y = *(int *) py;
if (x < y)
return -1;
if (x > y)
return 1;
return 0;
}
Previous slide
Next slide
Back to first slide
View graphic version