So I have to get scanf to read in a few strings that are separated by spaces. However, I don't know beforehand how many strings I need to read it it can be anywhere from 1 to 5, but I can't seem to get scanf to stop trying to read after hitting enter in the input. I have tried doing the naive %s %s %s %s %s but as you can imagine after hitting enter after say just 1 or 2 words it still expects to read more in and then I also tried to do %s%*[^\n]%s%*[^\n]%s%*[\n]%s%*[\n]%s%*[^\n] so that it would try to stop after a new line character but that didn't work either.
So what is the best way to get scanf to be able to have some optional input sections.
Thanks.
Edit: I know about strtok and fgets I was just looking to see if there was a way to do this with scanf