Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int words_3char(char *str){
- int i;
- int cnt = 0;
- int words = 0;
- for (i = 0; str[i] != '\0'; i++){
- if (str[i] != ' ' && str[i] != '\0'){
- cnt++;
- } else if (cnt == 3) {
- words++;
- cnt = 0;
- } else {
- cnt = 0;
- }
- }
- return words;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement