// глобальные константы (значения заданы для примера)
const int n = 10;
const int width = 2;
const int range = 10;
void RadixEnumSortOpt(int x[]) {
int source[n] = {0};
int count[width][range] = {0};
for (int i = 0; i < n; i++) {
for (int step = 0, rangepow = 1; step < width; step++, rangepow *= range) {
int d = (x[i] / rangepow) % range;
count[step][ d ]++;
}
}
for (int step = 0, rangepow = 1; step < width; step++, rangepow *= range) {
memcpy(source, x, sizeof(source));
int summNum = 0;
for (int i = 0; i < range; i++) {
int tmp = count[step][i];
count[step][i] = summNum;
summNum += tmp;
}
for (int i = 0; i < n; i++) {
int c = (source[i] / rangepow) % range;
x[ count[step][c] ] = source[i];
count[step][c]++;
}
}
}