0

bool vote(int voter, int rank, string name) { // TODO

for(voter=0;voter<=voter_count;voter++)
{
    for(rank=0;!strcmp(name, candidates[rank].name == 0);rank++)
    {
            preferences[voter][rank] = rank;
    }
}
    return false;

I was doing runoff and this error comes to me what's the problem ?

incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-Werror,-Wint-conversion] for(rank=0;!strcmp(name, candidates[rank].name == 0);rank++)

/usr/include/string.h:136:50: note: passing argument to parameter '__s2' here extern int strcmp (const char *__s1, const char *__s2)

1

looking at this part of it:

strcmp(name, candidates[rank].name == 0)

I'd say that the closing parenthesis is in the wrong place. The compiler doesn't know what to do with a test condition as a parameter to a function call.

Try putting the ) before the == instead of after the 0.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .