Why scanf doesn\'t work when I type \"Enter\" in the code below?
#include
#include
#include
int main(int a
Scanf looks through the input buffer for the specified format, which is string in this case. This has the effect of skipping your whitespaces. If you put a space between wording, it skips the space looking for the next string, similarly it will skip tabs, newlines etc. See what happens if you put a %c instead. It will pick up the newline because it is searching for a char now, and '\n' constitutes as a valid char.
If you want the same effect while getting whitespace, change it to a %c and remove the newline escape character at the print statement.