0
Any one can to help my in the c languge
Questin is: scan string and get the first word in the string if the string have the first word print it example: This is my moment and this is awsome Print:this.
8 Answers
+ 2
Use scanf to get input as a char array.
Create a new char array, and, using a for loop, add every character that is not a space. Make the loop break when it reaches a space or end of line and make sure it is not added to the new char array.
+ 5
Sorry but the question is hard to understand.
+ 3
The scanf() method stops reading the input as soon as it encounters a space character so make use of the fgets() to take user input and you can make use of a pointer and run a for loop to get your result easily.
+ 3
Sonic he is trying to read a string input like a sentence and just wants to print the first word from that string.
+ 2
Why do you need to complicate it?
This is one way.
https://code.sololearn.com/cJypyV9cc9qv/?ref=app
0
https://code.sololearn.com/cKX0aYGxbWOg/?ref=app
0
Avinesh thanks