为什么选A? D选项哪里有问题?

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果
  • img

D会将逗号读入c的

Format Specification Fields: scanf and wscanf Functions
A format specification has the following form:

%[*] [width] [{h | l | I64 | L}]type

The format argument specifies the interpretation of the input and can contain one or more of the following:

White-space characters: blank (' '); tab ('\t'); or newline ('\n'). A white-space character causes scanf to read, but not store, all consecutive white-space characters in the input up to the next non–white-space character. One white-space character in the format matches any number (including 0) and combination of white-space characters in the input.

Non–white-space characters, except for the percent sign (%). A non–white-space character causes scanf to read, but not store, a matching non–white-space character. If the next character in stdin does not match, scanf terminates.

Format specifications, introduced by the percent sign (%). A format specification causes scanf to read and convert characters in the input into values of a specified type. The value is assigned to an argument in the argument list.
The format is read from left to right. Characters outside format specifications are expected to match the sequence of characters in stdin; the matching characters in stdin are scanned but not stored. If a character in stdin conflicts with the format specification, scanf terminates, and the character is left in stdin as if it had not been read.

When the first format specification is encountered, the value of the first input field is converted according to this specification and stored in the location that is specified by the first argument. The second format specification causes the second input field to be converted and stored in the second argument, and so on through the end of the format string.

An input field is defined as all characters up to the first white-space character (space, tab, or newline), or up to the first character that cannot be converted according to the format specification, or until the field width (if specified) is reached. If there are too many arguments for the given specifications, the extra arguments are evaluated but ignored. The results are unpredictable if there are not enough arguments for the format specification.

Each field of the format specification is a single character or a number signifying a particular format option. The type character, which appears after the last optional format field, determines whether the input field is interpreted as a character, a string, or a number.

The simplest format specification contains only the percent sign and a type character (for example, %s). If a percent sign (%) is followed by a character that has no meaning as a format-control character, that character and the following characters (up to the next percent sign) are treated as an ordinary sequence of characters, that is, a sequence of characters that must match the input. For example, to specify that a percent-sign character is to be input, use %%.

An asterisk (*) following the percent sign suppresses assignment of the next input field, which is interpreted as a field of the specified type. The field is scanned but not stored.

以下为百度自动翻译:
格式规范字段:scanf和wscanf函数
格式规范的格式如下:
%[][width][{h | l | I64 | l}]型
format参数指定输入的解释,可以包含以下一项或多项:
空白字符:空白(“”);制表符('\t');或换行符('\n')。空白字符会导致scanf读取但不存储输入中的所有连续空白字符,直到下一个非空白字符。格式中的一个空白字符与输入中的任何数字(包括0)和空白字符组合匹配。
非空白字符,百分比符号(%)除外。非空白字符使scanf读取但不存储匹配的非空白字符。如果stdin中的下一个字符不匹配,scanf将终止。
格式规范,由百分号(%)引入。格式规范使scanf读取输入中的字符并将其转换为指定类型的值。该值被指定给参数列表中的参数。
格式从左到右读取。格式规范之外的字符应与标准文本中的字符序列相匹配;stdin中的匹配字符会被扫描,但不会被存储。如果stdin中的某个字符与格式规范冲突,scanf将终止,该字符将保留在stdin中,就像它没有被读取一样。
遇到第一个格式规范时,第一个输入字段的值将根据该规范进行转换,并存储在第一个参数指定的位置。第二个格式规范导致第二个输入字段被转换并存储在第二个参数中,依此类推,直到格式字符串的末尾。
输入字段定义为直到第一个空白字符(空格、制表符或换行符)的所有字符,或直到无法根据格式规范转换的第一个字符,或直到达到字段宽度(如果指定)为止。如果给定规范的参数太多,则会计算额外的参数,但忽略这些参数。如果格式规范没有足够的参数,结果是不可预测的。
格式规范的每个字段都是表示特定格式选项的单个字符或数字。显示在最后一个可选格式字段之后的类型字符决定输入字段是解释为字符、字符串还是数字。
最简单的格式规范只包含百分号和类型字符(例如,%s)。如果百分号(%)后面跟着一个作为格式控制字符没有意义的字符,则该字符和后面的字符(直到下一个百分号)将被视为一个普通的字符序列,即必须与输入匹配的字符序列。例如,要指定输入百分号字符,请使用%%。
百分号后面的星号(
)禁止分配下一个输入字段,该字段被解释为指定类型的字段。该字段已扫描但未存储。