count number of words in a string in c

Solutions on MaxInterview for count number of words in a string in c by the best coders in the world

showing results for - "count number of words in a string in c"
Isidora
01 May 2016
1/*
2 * C Program to Count Number of Words in a given Text Or Sentence
3 */
4#include <stdio.h>
5#include <string.h>
6 
7void main()
8{
9    char s[200];
10    int count = 0, i;
11 
12    printf("Enter the string:\n");
13    scanf("%[^\n]s", s);
14    for (i = 0;s[i] != '\0';i++)
15    {
16        if (s[i] == ' ' && s[i+1] != ' ')
17            count++;    
18    }
19    printf("Number of words in given string are: %d\n", count + 1);
20}
queries leading to this page
how to count how many words are in a string chow to count number of words in a sentence in ccount number of letters in a string ccount words in string ccount the number of letters in a string in chow can i count the number of words in a sentence in cwrite a program to count number of words in a text file in cc program to count number of words and characters in a stringcount the number of integers in a string that has been entered by the user in ccalculate no of words in a string cwrite a c program to count number of words in a given string how to count number of words in a sentence in c systems functionhow to count the words in string c programinghow to count the number of words in a string in chow to count number of words in string c programcount no of words in string in cprogram to count number of single character in a string in ccount word in string in ccount the number of words in a sentence in chow to count characters in word in cget the number of words from a string in chow to count number of words in string in chow to count words in a sentence in ccount the amount of letters in a string in ccount number of words in a string in cwrite a program in c to count the total number of words in a stringc program to count total no of keywords in a string in ccount the no of words in a string in cc count words in stringcount number of words in a sentence in chow to count numbers in string c porgramcount words in ccount how many words are in a string ccount the total number of words in a string in ccount number of words in a string in c