From ad9de15dd9a1af1638817692afcc2a445096d857 Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:11:23 +0000 Subject: Sun, Feb 18, 2024, 9:11 PM -08:00 --- wk3/pset/plurality/plurality.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'wk3/pset/plurality') 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 -- cgit v1.2.3