+ 1

Hi guys.. How to count length in string without space? (In C)

3rd Oct 2020, 11:08 AM
Briana
Briana - avatar
3 Respostas
+ 2
make your own function. probably with a while loop and a counter. The counter would increment each time you hopped to the next character. If they character is a space, dont increment. then just return the counter
3rd Oct 2020, 11:25 AM
Slick
Slick - avatar
+ 2
You can store a string in a charecter array in c. You can get array length by strlen(array); Without space you to split array by space using strtok() function and find split words length.. Or use a for loop to traverse array and count only charecters excluding space... You can use these ways to find length... Hope these helps..
3rd Oct 2020, 11:32 AM
Jayakrishna 🇮🇳
+ 2
I think you can iterate over the string array using for loop and use strstr function to check if the string contains some substring like "Ssss" or other animal voices.Checked if not equal to NULL the substring exists.The challenge is more easy with python than c.Space is symbolised by "\t" for tab in your case.
3rd Oct 2020, 3:41 PM
HBhZ_C
HBhZ_C - avatar