for (int i = 0; i < candidate_count; i++)
if (candidates[i].votes >= maxvote)
maxvote = candidates[i].votes;
winner = candidates[i].name;
printf("The winner is %s\n", winner);
the logic of your code to get the max number of votes is correct, but your logic to get the winner is a little off ok, let's walkthrough it lets say you got this data tt = 5 votes, lip = 2 votes, and jj = 5 votes, in this scenario your output should be both tt and jj right because they have the same number of votes which is 5. So your code goes like this first checks tt who has 5 votes, is 5 greater than or equal to 0 which is your max vote. yes right so the max vote = 5 and the winner = tt so we print tt, then we go look at lip who has 2 votes, is 2 greater than 5? no right so we don't change anything and just look at the next candidate which is jj, jj has 5 votes is 5 greater than or equal to the max vote which right now is 5, it's true right because 5 == 5 so now the maxvote stays 5 and the winner changes to jj and then we print jj. In this scenario its correct right we print both tt and jj, but let's look at another example.. tt = 2 votes, lip = 3 votes, jj = 5 votes. In this scenario jj should be the only winner since he has the most number of votes so lets go through your code, first tt who has 2 votes, is 2 greater than or equal to 0 which is your maxvotes, yes right so max vote = 2 and winner is equal to tt then we print tt, then we check lip who has 3 votes is 3 greater than or equal to 2? yes right so max vote now is = 3 and winner is = lip then we print lip, then lastly we check jj who has 5 votes, is 5 greater than or equal to 3? yes again so maxvote is equal to 5 and winner is equal to jj then we print jj, so your output would be tt\nlip\njj\n... which is wrong right so very slight logic error there hope you get it, tip would be to separate your code for getting the max vote and your code for getting the winner your very close just a few adjustments and your there. Btw just keep asking questions nothings wrong with asking them.. Don't worry I struggled also in this problem and also asked for help so don't feel bad 'cause I was just like you 3 days ago...