The scanf function allows the normal character in the format string, and in addition to the % c all conversion specification automatically skip all inputs to be at the front of the blank, all include no Spaces blank of special circumstances, if the input string to insert a blank, such as the scanf (" % d ", & amp; a); Or the scanf (" % d \ n ", & amp; A)); Blank in the format string means to skip all the blank before the next input item, so will I be able to understand into such operations will lead to the scanf inputs to ignore the first and the second input all blank in front of the item, read the second input item, like the scanf (" % d % d ", & amp; a); ,
.I don't think \ n common characters, there are two reasons why
One is the scanf function in the format string for ordinary character requirements as input, but such as the scanf (" % d \ n % d ", & amp; A, & amp; b); You don't enter \ n integer can read correctly, and add \ n can lead to read is not correct, b
Because in c is similar to the \ n can be defined as escape sequences rather than normal character, was defined as escape sequences, because it can't be printed and has the function of normal character can reflect
I add again, to explain, why do you think it is a common character rather than escape sequence, because the scanf (" % d \ n ", & amp; a); Can read correctly, but if you only enter \ '\' and do not enter 'n', the scanf can read the same, because escape sequences \ n means carriage returns, line is equal to the space, is just a lot of Spaces, and Spaces will skip the next input item before all of the blank, so when you lose the first input item, will lead to the scanf unable to read properly, the reason is that after the first entry is blank, it does not know where to stop, so when you type in the second input item, whether it is' \ 'or' \ n 'similar characters, which will lead to the scanf understand where to stop reading,
If the second input is an integer, it also understand that in this to stop, and then the second input item back into the input, waiting for the second reading,