I have a question about process that the scanf function takes when it encounters a non-whitespace character in the format string. According to the book I'm reading:
When a
scanffunction encounters a non-whitespace character in a format string,scanfcompares it with the next input character. If the two characters match,scanfdiscards the input character and continues processing the format string. If the characters don't match,scanfputs the offending character back into the input, then aborts without further processing the format string or reading characters from the input.
I am a little confused. It says that scanf compares it with the next input character and if the two characters match, scanf discards the input character. Why do we say that it compares with the "next" input character?
Does this mean that if we have a format string like
scanf("%d/%d", &x, &y) and the input 2/4, scanf compares with the four because it's the next input character from the /?