diff options
Diffstat (limited to 'wk3/pset/plurality')
-rw-r--r-- | wk3/pset/plurality/plurality.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/wk3/pset/plurality/plurality.c b/wk3/pset/plurality/plurality.c index feaa103..d913f5c 100644 --- a/wk3/pset/plurality/plurality.c +++ b/wk3/pset/plurality/plurality.c @@ -81,6 +81,10 @@ void print_winner(void) { int winners[candidate_count]; winners[0] = 0; + for (int j = 1; j < candidate_count; j++) + { + winners[j] = -1; + } for (int i = 1; i < candidate_count; i++) { if (candidates[winners[0]].votes < candidates[i].votes) // if the new candidate has more votes than previous |