Sorting an array of numbers by descending frequency
I see a couple occurrences of:

do
{
    hasSorted = 0;
    ...other things...
    if(hasSorted == 0)
    {
        break;
    }
}while(hasSorted == 0);


Did you mean if(hasSorted == 1) in those? If not, then you might want to just get rid of the whole if statement and replace the while condition with while(hasSorted != 0).



Also, comments that describe the whole function could look better on a separate line right before the function, so that the line doesn't get too long.