I'm not sure I understand why here:
// Update vote totals given a new vote
bool vote(string name)
{
for (int j = 0; j < candidate_count; j++)
{
if (strcmp(name, candidates[j].name) == 0)
{
candidates[j].votes++;
}
}
return true;
}
if I use the variable candidate_count
in this function I don't get any errors, but if I use the variable voter_count
I get this:
plurality.c:69:25: error: use of undeclared identifier 'voter_count'
for (int j = 0; j < voter_count; j++)
^
1 error generated.