分配给类型' struct PartyInfo'时不兼容的类型来自Int。类型

时间:2015-12-06 22:32:44

标签: c types

int main() {

struct PartyInfo maxVoteParty;
maxVoteParty = maxVoteParty = GetMaxVote(partiesInfo, noPartyLists);

printf("\n");

return 0;
}

struct PartyInfo GetMaxVote(struct PartyInfo array[], int partyListNumber)
{
    int maxVote = 0;
    int i;
    struct PartyInfo maxVoteParty;

    for (i = 0; i < partyListNumber; i++)
    {
        if (maxVote == 0 || maxVote < array[i].votes)
        {
            maxVote = array[i].votes;
            maxVoteParty = array[i];
        }
    }

    return maxVoteParty;
}

您好,

我在以下行收到上述错误:

maxVoteParty = maxVoteParty = GetMaxVote(partiesInfo, noPartyLists);

我对C非常陌生,但是使用过Java,C#,Python和其他一些语言,我遇到了很多新问题。

1 个答案:

答案 0 :(得分:1)

在第一次实际调用函数之前,您缺少GetMaxVote函数的函数原型。

struct PartyInfo GetMaxVote(struct PartyInfo array[], int partyListNumber);
相关问题