So walk through the text - but use the variable inWord, and your count will be correct in ALL cases. You increment a word ONLY when inWord is 1, and you reach a non alphanumeric char.
You can't just count spaces - that will fail, and you can't make it NOT fail, without a variable like inWord.



LinkBack URL
About LinkBacks




Then the text may be a C source file or something similar with other non alphabetical chars that you may want to have included. Anyway, I just left it there as an alternative.