void sorter(int *first, int *last) { while (first < --last) { for (int *p = first; p < last; ++p) { if (p[1] < p[0]) { //if p[0] and p[1] in wrong order, const int temp = p[0]; //swap them p[0] = p[1]; p[1] = temp; } } } }