December 11th, 2013, 11:03 PM
December 12th, 2013, 12:51 AM
In percentageCalculation, the for-loop ain't got no body:
You might want to lose that semicolon.
for (x = 0; x < candNum; x++);
percentages[x] = ((totalVotes / 100) * votes[x]);
December 12th, 2013, 12:57 AM
You have a ; after your for loop in the percentageCalculation function. As a result, the body of the for loop is empty and what appears to be the body is actually being run after the loop when x=5 which causes it to overrun your array bounds and corrupt the memory.
edit: beat to the punch.
Recycle your old CD's, don't just trash them
If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
December 12th, 2013, 08:13 AM
Wow, unbelievable. Thanks a lot guys!
December 12th, 2013, 11:19 AM
It is very rude and counter-productive to remove the original post. There are many more lurkers than participants here. One day, somebody else will come here via a search engine with the same problem and now that somebody will not be able to benefit from your experience.
December 12th, 2013, 11:22 AM
I had not considered that, but I understand. However, this was a simple syntax error resulting from a missing semicolon. Still, I'll keep this in mind for future posts.
Originally Posted by dwise1_aol
Comments on this post
December 12th, 2013, 04:10 PM
++ for this..
agrees totally with dwise1_aol !!