You don't say what is "not working" about it. But maybe this conditional if(candidates[i].votes>majority)
should be >=
.
Be forewarned: This program will not pass check50. Assuming plurality, from the spec:
You should not modify anything else in
plurality.c
other than the implementations of thevote
andprint_winner
functions (and the inclusion of additional header files, if you’d like).
The same warning applies to all the pset3 exercises.