I want to count the characters of a sentence without reading any spaces.
How to count characters in a sentence eliminating spaces?
Collapse
X
-
Juan GarciaTags: None -
"... without reading any spaces."
Do you mean 'without counting any of the spaces'?
What is the format of the sentence. Typically such things are formatted as null-terminated strings, but there are other possibilities. It is up to you to find out.
When you say 'spaces', do you mean 'any whitespace'? For example, do you want to count tab characters, newlines, etc? It is up to you to find out what characters shouldn't be counted.
The count you want is the total size of the sentence minus the number of not-to-be-counted characters in the sentence. Treat each of these as a separate problem. -
using a for loop, count the no of words and subtract the number of words from the value of i(when it reach the '\0')Comment
-
Your first post says to count characters, your most recent post says to count words. Which is it?
How would you describe how to recognize the beginning and end of a word? (using words, not a computer program)
Your most recent post refers to "the value of i". You haven't told us anything about what variable i is.Comment
Comment