April 3rd, 2013, 03:07 PM
Then don't use words over 19 characters in length! Or make wordl larger, large enough to contain that longest word that you will input plus one more character for the null-terminator
You are overflowing your buffer which results in you clobbering
the variables next to wordl.
int state, c, lc;
That means that you are overwriting them with the extra characters that overflow out of wordl. Which means that first lc, then c, and then state get frakked up.
Corrective action: Either make wordl large enough or else enter no word longer than 19 letters long.
BTW, buffer overflow is a common hacker exploit. Never allow buffer overflow to happen!