I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Strings

word count

viewed 8294 times and licensed 218 times
This function determines the number of words in a string.
Controller: nitin_ananda

Private project under development, to help contact the author: Contact Controller

Interface

C++

Word Count

 
intword_countchar*text )
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:
9

Returns

Number of words in the input string.

Authors

Nitin Ananda
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.