I'm stuck on trying to figure out how to take a multiple candidate data from a loop and figure out a winner from them by stating their name, ID, and total percent of votes within the same function. I also need to return the winning candidates ID from the function. For example: candidate 1 - is named Stevens with ID 13.07 and total votes of 1500, candidate 2 - is named George with ID 17.49 and total votes of 2000. I need to output the winner which is George with ID 17.49 and his percent of the total 3500 votes. This is what I have so far but I'm new to programming and have no idea how to figure this out. Any help would be greatly appreciated!
float CandidateData(int N, int X) {
    char candName[21];
    int i;
    double candID;
    int candVotes;
    int voteSum;
    int j = 0;
    double max = 0;
    double first;
    
    for (i = 0; i < N; i++) {    //N is the number of candidates 
        printf("Enter candidates name (20 characters max): ");
        scanf("%s", &candName);
        printf("Candidate name: %s\n\n", candName);
        printf("Enter candidate ID (float 01.01-52.99): ");
        candID = CandidateID(52.99);
        printf("Candidate ID is: %g\n\n", candID);
        printf("Enter %d precinct votes (int 1-1000): ", X);
        voteSum = 0;
        for (j = 0; j < X; j++) {   //X is number of precincts 
            candVotes = NumberOfCandidatesAndPrecincts(1000);
            printf("Precinct #%d = %d\n", j + 1, candVotes);
            voteSum = voteSum + candVotes;
        }
        printf("Total candidate votes = %d\n", voteSum);
        printf("Average votes for county = %d\n\n", voteSum / X);
    if (voteSum > max) {
        max = voteSum;
    }
    }
    
    printf("The winning candidate is %s with ID %g with %d% of total votes", candName, candID, )
    return (candID);
}
 
    