Basically, it's because a white space character is not valid for %d
or %f
, so they will skip them.
But a white space character is a valid character, so %c
will try to process it.
C99 §7.19.6.2 The fscanf function section 8
Input white-space characters (as specified by the
isspace
function) are skipped, unless the specification includes a[
,c
,orn
specifier.