how do I insert into a variable a text input from the user including white spaces? I'm trying to write a function to calculate characters in a text input but when I create the array the variable only takes the first word and the rest is ignored.
Here is my code:
int main(void){
char text[100];
printf("Enter some text:\n");
scanf("%s", text);
printf(text);
printf("\n%i", strlen(text));
}
This works only if the user inputs one word but I would like my code to be able to take the user's full input including white spaces. Thanks for your help!