Q:

What happens when a scanf("%s",s); encounters two or more words and only one variable is provided?

When a scanf("%s",s); (one of many ways to get a string which is not perfect) encounters a space in the input, it will try to put it in another variable, right? But what hapens if there is only one variable provided as in this case?
Also what other ways are used to input a string? which is the esiest or best one to use and which one does not give problems like the gets(s); function?
Here is my s_insert function now:
// pointer to pointer needed when you allocate memory in the function
void s_insert(char **string_one){   //inserts string (loss of original data)
    *string_one=(char*)malloc(200);
    fgets (*string_one,200,stdin);
} 

A:

scanf for %s data specification reads characters before first space symbol (' ', '\n' or '\t'). If you want to read string with spaces (more than two words) use fgets function, that is more safe than 'gets' because you can set the maximum number of character that can be allocated in your memory and avoid segmentation fault.

