scanf读取字符
Let suppose, we want to read time in HH:MM:SS format and store in the variables hours, minutes and seconds, in that case we need to skip columns (:) from the input values.
假设,我们要读取HH:MM:SS格式的时间 ,并将其存储在小时 , 分钟和秒的变量中,在这种情况下,我们需要从输入值中跳过列(:)。
There are two ways to skip characters:
有两种跳过字符的方法:
Skip any character using %*c in scanf
在scanf中使用%* c跳过任何字符
And, by specifying the characters to be skipped
并且,通过指定要跳过的字符