+ 2
How can I solve this problem
When the user enter a string it consider the space as the end of the string
2 ответов
+ 2
For sure there is solution to print the whole sentence even the presence of the space
+ 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;
}