Search code examples
cpointersinputstdinformat-specifiers

What does %*c do when getting input from stdin?


I know what it does, and it is a format specifier.
but I have no clue on how this works.
It gets the last input, and just doesn't save it. But how?


Solution

  • The starting asterisk indicates that the data is to be read from the stream but ignored (i.e. it is not stored in the location pointed by an argument). Reference: http://www.cplusplus.com/reference/cstdio/scanf/

    So the data would not be saved in the variable.