Answer the question
In order to leave comments, you need to log in
Is there a command in C that calculates how many words are in a string variable?
Like for example a command strlen();
that calculates the number of characters in a string.
I need to count the number of words in a line that the user will enter in the terminal, so that I can then print the beginning of each word.
For example, the user enters: Sasha Kozlov and the program displays SK.
For example, when declaring the main function: int main (int argc, string argv[]) { }
just like int argc calculates the number of arguments entered by the user when starting the program, I need the number of words entered by the user into the terminal using the getstring()
.
Answer the question
In order to leave comments, you need to log in
\0 is always one - it's the line ending character.
But there are no functions for counting any Wishlist, including the number of words. Because the language doesn't need it. You need - you and consider yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question