Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - scanf("%*c%*[^\n]”)
scanf("%*c%*[^\n]”)
scanf("%*c%*[^\n]”; In this statement, %*c means to read a character, but this character is not saved in a variable, so there is no need for a corresponding char type parameter. % * [\ n] means reading a string. The characters in the string can only be those specified in [], and the string is not saved. If it is %*[abcd], you can only enter a string composed of abcd, such as aabbddcc. If other characters are encountered, the scanf function will return. Here is% * [\n], which means "no", \n is a line break, and% * [\ n] means reading all characters that are not line breaks. So scanf ("%* c% * [\ n]"); Read a character, then read a string that is not a newline character, and then return without saving. Actually, it means skipping a line. Your input to this program may be as follows: 212abcd34xxxxxxxxx scanf ("%d",&; k); Read in k to make k 2, scanf ("%d \ n% d ",&; n & amp; Win); Read in n and win, which are 1, 2 respectively. At this time, the following abcd is unnecessary, and scanf ("%* c% * [\ n]") is used; Jump over. Then continue reading scanf ("%d \ n% d ",&; n & amp; Win), so n = 3 and win = 4. Use scanf ("%* c% * [\ n]") at this time; Skip xxxxxxxxx below.