Using printf
, when I do:
printf("\n\tQualquer coisa\n");
It inserts this first into a buffer and then prints to the screen (standard output)?
Using scanf
with the format %c
, it captures the character-to-character buffer. But when I use the %s
format? It stops when it finds a space or enter, but does it leave that enter or buffer space? If yes, how can I read something from the buffer and not capture it?
And in case of these scanf
:
scanf("%c\n", &caracter);
scanf("%s\n", string);
These scanf
above reads from the buffer a character (for %c
) and a string (for %s
) and remove the buffer the next enter? What happens ? What do these characters mean within the quotation marks? I always imagined that in% w / o%, the first parameter was only the formats to be read.
I would like you to explain me in detail, because in class and in books, the explanations are superfluous, and I know that the operation of this is not very simple. If there is any documentation that reports well the behavior of this, please pass the link to me, because I searched the C standard and did not find it.
Thank you.