Here is my code for the add_pairs() function. I have tested it with the debugger and it seems to work fine. However, check50 tells me that it's not generating correct pair count.
'''
void add_pairs(void)
{
// TODO
for (int i = 0; i < candidate_count; i++)
{
for (int j = 0; j < candidate_count; j++)
{
if (i != j)
{
if (preferences[i][j] > preferences[j][i])
{
pairs[pair_count].winner = i;
pairs[pair_count].loser = j;
pair_count += 1;
}
else if (preferences[i][j] < preferences[j][i])
{
pairs[pair_count].winner = j;
pairs[pair_count].loser = i;
pair_count += 1;
}
else
{
return;
}
}
}
}
}
'''
I can't figure out where I am going wrong. Please can someone help?
Thanks in advance.