char is simply a small integer, so there's no problem with using it together with "%d", as long as the values are within the range [CHAR_MIN, CHAR_MAX].

However the problem is you're reading only...