0

What's the difference between these two codes? Why does the first return me no error from check50 while the second one does?

void sort_pairs(void)
{
    int max;
    for (int i = 0; i < pair_count; i++)
    {
        max = i;
        for (int j = i + 1; j < pair_count; j++)
            if (preferences[pairs[j].winner][pairs[j].loser] > preferences[pairs[max].winner][pairs[max].loser])
            {
                max = j;
            }
            pair temp = pairs[i];
            pairs[i] = pairs[max];
            pairs[max] = temp;
    }
    return;
}
void sort_pairs(void)
{
    int max;
    for (int i = 0; i < pair_count; i++)
    {
        max = i;
        for (int j = i + 1; j < pair_count; j++)
        {
            if (preferences[pairs[j].winner][pairs[j].loser] > preferences[pairs[max].winner][pairs[max].loser])
            {
                max = j;
            }
            pair temp = pairs[i];
            pairs[i] = pairs[max];
            pairs[max] = temp;
        }
    }
    return;
}

Can someone kindly please enlighten me, kinda still new to c :/

You must log in to answer this question.

Browse other questions tagged .