First, due to promotion, a type that conforms to the conversion specification may not match the type that is passed to the function. For example, characters are promoted to int, so printf ("% c") really expects an int, which is then passed to an unsigned char. Passing int directly has the same effect as passing that was entered into an unsigned char, and therefore is safe.
If the argument does not have the expected type, for example, if you pass a float instead of an integer, then the result will be undefined.
This is especially disastrous with scanf () because the arguments are pointers. If you pass, tell the pointer to char, when the function expects a pointer to a float, then the function will try to write (say) 4 bytes to 1 byte, which is bad. You may well get segfault.
source share