There is a data type mismatch, although mostly it does not prevent you from running the program, only it will give you wrong outputs.
But you need to understand the basic difference in int type and char type, especially in C context. In high-level languages, they sometimes have a same size for data. In C, they have different (a lot different) sizes, char is only 1 byte, and int is 4 bytes (on 32 bit, and different on others).
C data types - Wikipedia[
^]
Later on, you are trying to do a
%d
, which expects a decimal. And same is the case for the
%s
, which expects a char type. So you are printing in one format, and accepting in another, which C will never complain about — only you will. You need to change either
%d
and work in all characters, or change that
%s
to work with integers only. Also, once you have made this change, you can select what type of array you want to work with.
Consider reading here,
scanf format string - Wikipedia[
^]