+ 1
How to count word without space in string (but the string have very long space). I want to count without space (C language)
Example : Hi Guys Nice to meet you That's count 6
9 Answers
+ 6
learn about strtok function in c to solve that...
Edit : Briana
https://www.tutorialspoint.com/c_standard_library/c_function_strtok.htm
http://www.cplusplus.com/reference/cstring/strtok/
+ 4
Pls post ur try(code) in the description section,so that we can help with tht.
Also ,how does the count becomes 6 and not 19.
+ 1
Davide
It's taking input... It's fine for while taking input.
But I mean, you have already stored string in storage and you have to find number of words in that string... In that case what you do?
+ 1
Jayakrishna🇮🇳 oh you are right!😱🤣😅
Briana sorry for making confusion. Jayakrishna🇮🇳 was right about strtok
edit: you could also use a loop with isalpha() and a counter for the number of words.
0
Jayakrishna🇮🇳 Ok, thankyou
0
Davide is that work for very long space and space in beggining and last?
0
Davide its not the input. It's a string of words of a character array..
Any ways, you can post it as an alternative solution with more clear explanation if you know it...
0
Davide what I mean, it is not the input.
If you are saying, still it works then can you show code with loops...? So that I can understand what you are about..!
0
Davide okay