I am a beginner at c. I have been assigned a project that wants a user to enter text from the keyboard and then the number of words is counted.

Before I have written programs that count number of words by counting spaces; however, this program includes spaces and punctuation.

Basically I am having trouble(spent last 6 hours) trying to figure out how to write a loop. A loop that would notice a the first letter or digit and once it hits an element that is not letter or digit would increment a counting variable by 1.

So the loop would run and do something when it hits a letter or number and stop at first element that does is not letter or number.

This would continue til the end of a string.

Any insight would be greatly appreciated!!