To quote the C11
standard, chapter §7.21.6.2, fscanf()
[...] Each conversion specification is introduced by the character %
.
After the %, the following appear in sequence:
— An optional assignment-suppressing character *
.
— [...]
— A conversion specifier character
and regarding the behavior,
[..] Unless assignment suppression was indicated by a *
, the
result of the conversion is placed in the object pointed to by the first argument following
the format argument that has not already received a conversion result. [...]
That means, in case of a format specifier like "%*c"
, a char
will be read from the stdin
but the scanned value won't get stored or assigned to anything. So, you don't need to supply a corresponding parameter.
So, in this case,
scanf("%d%*c", &word_count);
is a perfectly valid statement.
For example, What it does in a *nix environment is to clear the input buffer from the newline
which is stored due to pressing ENTER key after the input.