Can I make last part of counting sort become to be starting from lowest index?
Prior to the last loop, c[i] holds the index of last element of bucket i plus 1. It's why when you use c[i] to address items in bucket i you need to go back. But c[i-1] contains index of the first element of bucket i, so you can just use it... except that you need index for bucket 0 too.

So the simplest way is to modify third cycle making it to write initial index of bucket i to c[i]. It may be done f.e. with extra temporary (note that i in revised loop starts from 0):

sum = 0;
for (int i = 0; i &lt;= 5; i++) 
{
    sum += c[i];  
    c[i] = sum - c[i];
}


Note that since indexes in b starts from 1, you need to pre-increment c[a[i]] in new version of last loop (if indexes in b should go from 0, do post-increment instead):

for (int i = 1; i &lt;= 8; i++)
{
    c[a[i]]++;
    b[c[a[i]]] = a[i];
}