December 11th, 2013, 10:03 PM
December 11th, 2013, 11:51 PM
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 11th, 2013, 11:57 PM
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, 07:13 AM
Wow, unbelievable. Thanks a lot guys!
December 12th, 2013, 10: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, 10: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, 03:10 PM
++ for this..
agrees totally with dwise1_aol !!