Plurality - Check50 prints Charlie but not Alice and Bob?

I don't see any comparison in your print_winner(). Im not quite sure how you are trying to implement the function but here is a working example of how you could do it:

void print_winner(void)

{

// check highest votes

int highest_vote = 0;

for (int i = 0; i < candidate_count; i++)!<

{

if (highest_vote < candidates[i].votes)!<

{

highest_vote = candidates[i].votes;

}

}

for (int i = 0; i < candidate_count; i++)!<

{

if (highest_vote == 0)

{

return;

}

else if (highest_vote == candidates[i].votes)

{

printf("%s\n", candidates[i].name);

}

}

return;

}

/r/cs50 Thread