I take user input in char name[20]
using fgets
like this:
fgets(name,20,stdin);
The user enters two strings separated by white space like John Smith
. What if I wanted to use John
and Smith
in two strings like char name[20]
, char surname[20]
or just compare John
and Smith
using strcmp
?
I tried a lot, but I did not find any way to do this.
What are some ways to fix this kind of problem?