+ 2

How can I solve this problem

When the user enter a string it consider the space as the end of the string

11th Nov 2020, 4:08 PM
Amal Gil
Amal Gil - avatar
2 ответов
+ 2
For sure there is solution to print the whole sentence even the presence of the space
11th Nov 2020, 4:47 PM
Amal Gil
Amal Gil - avatar
+ 1
/*Use fgets. You first need to create an char array, Determine it's length. Then on fgets you indicate the array you created, fgets(yourarrayname, Then the length that you want the input to have. For example: fgets(yourarrayname, 23 And add stdin to indicate console use. fgets(yourarrayname, 23, stdin); Here's a simple code:*/ #include <stdio.h> char str_array[50]; int main () { fgets(str_array, 50, stdin); printf("%s", str_array); return 0; }
15th Nov 2020, 9:57 AM
Lucas Villani
Lucas Villani - avatar