+ 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

31st Oct 2020, 1:43 PM
Briana
Briana - avatar
9 Respostas
31st Oct 2020, 1:55 PM
Jayakrishna 🇮🇳
+ 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.
31st Oct 2020, 1:48 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 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?
31st Oct 2020, 3:02 PM
Jayakrishna 🇮🇳
+ 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.
31st Oct 2020, 3:07 PM
Davide
Davide - avatar
0
Jayakrishna🇮🇳 Ok, thankyou
31st Oct 2020, 1:59 PM
Briana
Briana - avatar
0
Davide is that work for very long space and space in beggining and last?
31st Oct 2020, 2:30 PM
Briana
Briana - avatar
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...
31st Oct 2020, 2:38 PM
Jayakrishna 🇮🇳
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..!
31st Oct 2020, 2:48 PM
Jayakrishna 🇮🇳
0
Davide okay
31st Oct 2020, 3:55 PM
Briana
Briana - avatar