0

my code

for (int i = 0; i < candidate_count; i++)
{
    if (strcmp(candidates[i].name, name) == 0)
    {
        preferences[voter][rank] = i; 
        return true;
    }
  }

I'm able to printout the correct matrix later in my code.

But I struggle to understand why preferences[voter][rank] = i; only seems to update the rank value, but not sure if it's correct?

What if i also wanted to update the voter value?

PS: Can't seem to find a good guide online explaining how to update two dimensional c arrays like this!

1 Answer 1

0

I think i got it : preferences[voter][rank] = the Location in the Matrix and = i is the value it gets. After a 2 day break from the pset i didn't remember that detail.

You must log in to answer this question.

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