FUNCTION
word_count
This function determines the number of words in a string.
Interface
The assumptions involved are:
- The string is null terminated
- The words seperation char is only a space and nothing else.
Example 1
#include<codecogs/strings/word_count.h>
void main () {
char * sz = "The quick brown fox jumps over the
lazy dog.";
int nWordCount = word_count (sz);
printf ("The word count is %d", nWordCount);
}Output:
9Parameters
szInputString
The null terminated input string
Returns
Number of words in the input string.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.