As of the printf function is concerned, I understand the following from few references and experiments.
- When we try to print an integer value with format specifiers that are used for float (or) double and vice the versa the behaviour is unpredictable.
- But it is possible to use
%cto print the character equivalent of the integer value. Also using of%dto print ASCII value (integer representations) of character is acceptable.
Similarly, what is the behaviour of scanf, if there is a mismatch of format specifier and the arguements passed to scanf. Does the standards define it?